提交 134e700a 编写于 作者: L lana

Merge

......@@ -88,3 +88,6 @@ ab0d3f54a63f2aadfcdd2e14b81f79362ce454e2 jdk7-b109
fb63a2688db807a73e2a3de7d9bab298f1bff0e8 jdk7-b111
b53f226b1d91473ac54184afa827be07b87e0319 jdk7-b112
61d3b9fbb26bdef56cfa41b9af5bc312a22cbeb8 jdk7-b113
e250cef36ea05e627e7e6f7d75e5e19f529e2ba3 jdk7-b114
449bad8d67b5808ecf0f927683acc0a5940f8c85 jdk7-b115
1657ed4e1d86c8aa2028ab5a41f9da1ac4a369f8 jdk7-b116
......@@ -251,13 +251,13 @@ compile_all_props: $(COMPILEPROPERTIES_JARFILE) $(COMPILE_PROP_options)
# Make sure the build rule creates all the properties
resources:
ifneq ($(PROPERTIES_FILES),)
ifneq ($(strip $(PROPERTIES_FILES)),)
resources: strip_prop_options_clean strip_all_props
clobber clean::
$(RM) $(STRIP_PROP_FILES) $(STRIP_PROP_options)
endif
ifneq ($(COMPILED_PROPERTIES),)
ifneq ($(strip $(COMPILED_PROPERTIES)),)
resources: compile_prop_options_clean compile_all_props
clobber clean::
$(RM) $(COMPILE_PROP_JAVA_FILES) $(COMPILE_PROP_options)
......
......@@ -45,7 +45,7 @@ JNLP_FIRST_COPYRIGHT_YEAR = 1998
PLUGIN2_FIRST_COPYRIGHT_YEAR = 2007
# Oracle name
COMPANY_NAME = Oracle and/or its affiliates
FULL_COMPANY_NAME = Oracle and/or its affiliates
# Copyright address
COMPANY_ADDRESS = 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA.
......
......@@ -341,7 +341,33 @@ dummy:=$(warning "WARNING: Using definitions from $(_PRIVATE_DEFS_FILE)")
include $(_PRIVATE_DEFS_FILE)
endif
# OUTPUTDIR: Location of all output for the build
ifdef ALT_OUTPUTDIR
OUTPUTDIR:=$(subst \,/,$(ALT_OUTPUTDIR))
# Assumes this is absolute (checks later)
ABS_OUTPUTDIR:=$(OUTPUTDIR)
else
ifndef _OUTPUTDIR
# Default: Get "build" parent directory, which should always exist
ifndef BUILD_PARENT_DIRECTORY
BUILD_PARENT_DIRECTORY=$(BUILDDIR)/..
endif
ifdef OPENJDK
_OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)$(OPENJDK_SUFFIX)
else
_OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)
endif
_OUTPUTDIR=$(BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
endif
OUTPUTDIR:=$(_OUTPUTDIR)
endif
# Check for spaces and null value
OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR)
OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR)
# Get platform specific settings
# NB: OUTPUTDIR must be defined. Otherwise hotspot import detection will not work correctly
# On other hand this must be included early as it provides platform specific defines such as FullPath
include $(JDK_MAKE_SHARED_DIR)/Defs-$(PLATFORM).gmk
# Components
......@@ -478,32 +504,6 @@ endif
CACERTS_FILE:=$(call AltCheckSpaces,CACERTS_FILE)
CACERTS_FILE:=$(call AltCheckValue,CACERTS_FILE)
# OUTPUTDIR: Location of all output for the build
ifdef ALT_OUTPUTDIR
OUTPUTDIR:=$(subst \,/,$(ALT_OUTPUTDIR))
# Assumes this is absolute (checks later)
ABS_OUTPUTDIR:=$(OUTPUTDIR)
else
ifndef _OUTPUTDIR
# Default: Get "build" parent directory, which should always exist
ifndef BUILD_PARENT_DIRECTORY
BUILD_PARENT_DIRECTORY=$(BUILDDIR)/..
endif
ABS_BUILD_PARENT_DIRECTORY:=$(call FullPath,$(BUILD_PARENT_DIRECTORY))
ifdef OPENJDK
_OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)$(OPENJDK_SUFFIX)
else
_OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)
endif
_OUTPUTDIR=$(BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
ABS_OUTPUTDIR:=$(ABS_BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
endif
OUTPUTDIR:=$(_OUTPUTDIR)
endif
# Check for spaces and null value
OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR)
OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR)
#
# When signing the JCE framework and provider, we could be using built
# bits on a read-only filesystem. If so, this test will fail and crash
......@@ -519,7 +519,13 @@ endif
# Define absolute path if needed and check for spaces and null value
ifndef ABS_OUTPUTDIR
ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR))
ifdef _OUTPUTDIRNAME
#Could not define this at the same time as _OUTPUTDIRNAME as FullPath is not defined at that point
ABS_BUILD_PARENT_DIRECTORY:=$(call FullPath,$(BUILD_PARENT_DIRECTORY))
ABS_OUTPUTDIR:=$(ABS_BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
else
ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR))
endif
endif
ABS_OUTPUTDIR:=$(call AltCheckSpaces,ABS_OUTPUTDIR)
ABS_OUTPUTDIR:=$(call AltCheckValue,ABS_OUTPUTDIR)
......@@ -572,10 +578,23 @@ ifeq ($(PLATFORM), windows)
ANT_HOME := $(call DirExists,$(JDK_DEVTOOLS_DIR)/share/ant/latest,,)
endif
endif
# There are few problems with ant we need to workaround:
# 1) ant is using temporary directory java.io.tmpdir
# However, this directory is not unique enough and two separate ant processes
# can easily end up using the exact same temp directory. This may lead to weird build failures
# To workaround this we will define tmp dir explicitly
# 2) ant attempts to detect JDK location based on java.exe location
# This is fragile as developer may have JRE first on the PATH.
# To workaround this we will specify JAVA_HOME explicitly
ANT_TMPDIR = $(ABS_OUTPUTDIR)/tmp
ANT_WORKAROUNDS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)' JAVA_HOME='$(BOOTDIR)'
ifeq ($(ANT_HOME),)
ANT = ant
ANT = $(ANT_WORKAROUNDS) ant
else
ANT = $(ANT_HOME)/bin/ant
ANT = $(ANT_WORKAROUNDS) $(ANT_HOME)/bin/ant
endif
ifdef ALT_COPYRIGHT_YEAR
......
......@@ -57,7 +57,7 @@ JLS3_URL = http://java.sun.com/docs/books/jls/
# Common Java trademark line
JAVA_TRADEMARK_LINE = Java is a trademark or registered trademark of \
$(COMPANY_NAME) in the US and other countries.
$(FULL_COMPANY_NAME) in the US and other countries.
#
# Definitions for imported components
......
......@@ -69,5 +69,8 @@ CPPFLAGS += \
-I$(PLATFORM_SRC)/native/$(PKGDIR)/medialib
OTHER_CFLAGS += -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES
OTHER_LDLIBS = $(LIBM) -ldl
ifneq ($(PLATFORM), windows)
OTHER_LDLIBS = $(LIBM) -ldl
endif
......@@ -45,7 +45,7 @@ public class BMPImageReaderSpi extends ImageReaderSpi {
private boolean registered = false;
public BMPImageReaderSpi() {
super("Sun Microsystems, Inc.",
super("Oracle Corporation",
"1.0",
formatNames,
entensions,
......
......@@ -50,7 +50,7 @@ public class BMPImageWriterSpi extends ImageWriterSpi {
private boolean registered = false;
public BMPImageWriterSpi() {
super("Sun Microsystems, Inc.",
super("Oracle Corporation",
"1.0",
formatNames,
entensions,
......
......@@ -36,7 +36,7 @@ import javax.imageio.stream.ImageInputStream;
public class GIFImageReaderSpi extends ImageReaderSpi {
private static final String vendorName = "Sun Microsystems, Inc.";
private static final String vendorName = "Oracle Corporation";
private static final String version = "1.0";
......
......@@ -36,7 +36,7 @@ import com.sun.imageio.plugins.common.PaletteBuilder;
public class GIFImageWriterSpi extends ImageWriterSpi {
private static final String vendorName = "Sun Microsystems, Inc.";
private static final String vendorName = "Oracle Corporation";
private static final String version = "1.0";
......
......@@ -169,7 +169,7 @@ public class JPEG {
public static final int ADOBE_YCCK = 2;
// Spi initialization stuff
public static final String vendor = "Sun Microsystems, Inc.";
public static final String vendor = "Oracle Corporation";
public static final String version = "0.5";
// Names of the formats we can read or write
public static final String [] names = {"JPEG", "jpeg", "JPG", "jpg"};
......
......@@ -36,7 +36,7 @@ import javax.imageio.stream.ImageInputStream;
public class PNGImageReaderSpi extends ImageReaderSpi {
private static final String vendorName = "Sun Microsystems, Inc.";
private static final String vendorName = "Oracle Corporation";
private static final String version = "1.0";
......
......@@ -38,7 +38,7 @@ import javax.imageio.stream.ImageOutputStream;
public class PNGImageWriterSpi extends ImageWriterSpi {
private static final String vendorName = "Sun Microsystems, Inc.";
private static final String vendorName = "Oracle Corporation";
private static final String version = "1.0";
......
......@@ -49,7 +49,7 @@ public class WBMPImageReaderSpi extends ImageReaderSpi {
private boolean registered = false;
public WBMPImageReaderSpi() {
super("Sun Microsystems, Inc.",
super("Oracle Corporation",
"1.0",
formatNames,
entensions,
......
......@@ -49,7 +49,7 @@ public class WBMPImageWriterSpi extends ImageWriterSpi {
private boolean registered = false;
public WBMPImageWriterSpi() {
super("Sun Microsystems, Inc.",
super("Oracle Corporation",
"1.0",
formatNames,
entensions,
......
......@@ -33,7 +33,7 @@ import javax.imageio.stream.FileImageInputStream;
public class FileImageInputStreamSpi extends ImageInputStreamSpi {
private static final String vendorName = "Sun Microsystems, Inc.";
private static final String vendorName = "Oracle Corporation";
private static final String version = "1.0";
......
......@@ -33,7 +33,7 @@ import javax.imageio.stream.FileImageOutputStream;
public class FileImageOutputStreamSpi extends ImageOutputStreamSpi {
private static final String vendorName = "Sun Microsystems, Inc.";
private static final String vendorName = "Oracle Corporation";
private static final String version = "1.0";
......
......@@ -36,7 +36,7 @@ import javax.imageio.stream.MemoryCacheImageInputStream;
public class InputStreamImageInputStreamSpi extends ImageInputStreamSpi {
private static final String vendorName = "Sun Microsystems, Inc.";
private static final String vendorName = "Oracle Corporation";
private static final String version = "1.0";
......
......@@ -36,7 +36,7 @@ import javax.imageio.stream.MemoryCacheImageOutputStream;
public class OutputStreamImageOutputStreamSpi extends ImageOutputStreamSpi {
private static final String vendorName = "Sun Microsystems, Inc.";
private static final String vendorName = "Oracle Corporation";
private static final String version = "1.0";
......
......@@ -34,7 +34,7 @@ import javax.imageio.stream.FileImageInputStream;
public class RAFImageInputStreamSpi extends ImageInputStreamSpi {
private static final String vendorName = "Sun Microsystems, Inc.";
private static final String vendorName = "Oracle Corporation";
private static final String version = "1.0";
......
......@@ -34,7 +34,7 @@ import javax.imageio.stream.FileImageOutputStream;
public class RAFImageOutputStreamSpi extends ImageOutputStreamSpi {
private static final String vendorName = "Sun Microsystems, Inc.";
private static final String vendorName = "Oracle Corporation";
private static final String version = "1.0";
......
......@@ -1069,7 +1069,7 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
private static class RealTimeSequencerInfo extends MidiDevice.Info {
private static final String name = "Real Time Sequencer";
private static final String vendor = "Sun Microsystems";
private static final String vendor = "Oracle Corporation";
private static final String description = "Software sequencer";
private static final String version = "Version 1.0";
......
......@@ -100,6 +100,12 @@ public abstract class AWTEvent extends EventObject {
transient boolean focusManagerIsDispatching = false;
transient boolean isPosted;
/**
* Indicates whether this AWTEvent was generated by the system as
* opposed to by user code.
*/
private transient boolean isSystemGenerated;
/**
* The event mask for selecting component events.
*/
......@@ -235,6 +241,12 @@ public abstract class AWTEvent extends EventObject {
public void setPosted(AWTEvent ev) {
ev.isPosted = true;
}
public void setSystemGenerated(AWTEvent ev) {
ev.isSystemGenerated = true;
}
public boolean isSystemGenerated(AWTEvent ev) {
return ev.isSystemGenerated;
}
});
}
......@@ -554,6 +566,7 @@ public abstract class AWTEvent extends EventObject {
}
}
}
that.isSystemGenerated = this.isSystemGenerated;
}
void dispatched() {
......
......@@ -71,12 +71,13 @@ public class Canvas extends Component implements Accessible {
@Override
void setGraphicsConfiguration(GraphicsConfiguration gc) {
CanvasPeer peer = (CanvasPeer)getPeer();
if (peer != null) {
gc = peer.getAppropriateGraphicsConfiguration(gc);
synchronized(getTreeLock()) {
CanvasPeer peer = (CanvasPeer)getPeer();
if (peer != null) {
gc = peer.getAppropriateGraphicsConfiguration(gc);
}
super.setGraphicsConfiguration(gc);
}
super.setGraphicsConfiguration(gc);
}
/**
......
......@@ -4187,7 +4187,7 @@ public class Container extends Component {
return true;
}
for (Container cont = getContainer();
for (Container cont = this;
cont != null && cont.isLightweight();
cont = cont.getContainer())
{
......
......@@ -64,6 +64,9 @@ class SequencedEvent extends AWTEvent implements ActiveEvent {
public SequencedEvent(AWTEvent nested) {
super(nested.getSource(), ID);
this.nested = nested;
// All AWTEvents that are wrapped in SequencedEvents are (at
// least currently) implicitly generated by the system
SunToolkit.setSystemGenerated(nested);
synchronized (SequencedEvent.class) {
list.add(this);
}
......
......@@ -318,6 +318,12 @@ public final class SplashScreen {
checkVisible();
_close(splashPtr);
image = null;
SplashScreen.markClosed();
}
}
static void markClosed() {
synchronized (SplashScreen.class) {
wasClosed = true;
theInstance = null;
}
......
......@@ -928,7 +928,10 @@ public class Window extends Container implements Accessible {
return;
}
if (beforeFirstWindowShown.getAndSet(false)) {
// We don't use SplashScreen.getSplashScreen() to avoid instantiating
// the object if it hasn't been requested by user code explicitly
SunToolkit.closeSplashScreen();
SplashScreen.markClosed();
}
}
......
......@@ -29,9 +29,11 @@ import java.awt.Event;
import java.awt.Component;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
import sun.util.logging.PlatformLogger;
import java.util.Arrays;
import sun.awt.AWTAccessor;
import sun.util.logging.PlatformLogger;
/**
* The root event class for all component-level input events.
*
......@@ -54,6 +56,7 @@ import java.util.Arrays;
* @since 1.1
*/
public abstract class InputEvent extends ComponentEvent {
private static final PlatformLogger logger = PlatformLogger.getLogger("java.awt.event.InputEvent");
/**
......@@ -288,6 +291,12 @@ public abstract class InputEvent extends ComponentEvent {
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
AWTAccessor.setInputEventAccessor(
new AWTAccessor.InputEventAccessor() {
public int[] getButtonDownMasks() {
return InputEvent.getButtonDownMasks();
}
});
}
/**
......
......@@ -358,6 +358,15 @@ public abstract class SampleModel
int cnt = 0;
Object o = null;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x1 < x || x1 > width ||
y < 0 || y1 < y || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
switch(type) {
case DataBuffer.TYPE_BYTE:
......@@ -370,8 +379,8 @@ public abstract class SampleModel
else
bdata = (byte[])obj;
for (int i=y; i<y+h; i++) {
for (int j=x; j<x+w; j++) {
for (int i=y; i<y1; i++) {
for (int j=x; j<x1; j++) {
o = getDataElements(j, i, o, data);
btemp = (byte[])o;
for (int k=0; k<numDataElems; k++) {
......@@ -393,8 +402,8 @@ public abstract class SampleModel
else
sdata = (short[])obj;
for (int i=y; i<y+h; i++) {
for (int j=x; j<x+w; j++) {
for (int i=y; i<y1; i++) {
for (int j=x; j<x1; j++) {
o = getDataElements(j, i, o, data);
stemp = (short[])o;
for (int k=0; k<numDataElems; k++) {
......@@ -416,8 +425,8 @@ public abstract class SampleModel
else
idata = (int[])obj;
for (int i=y; i<y+h; i++) {
for (int j=x; j<x+w; j++) {
for (int i=y; i<y1; i++) {
for (int j=x; j<x1; j++) {
o = getDataElements(j, i, o, data);
itemp = (int[])o;
for (int k=0; k<numDataElems; k++) {
......@@ -439,8 +448,8 @@ public abstract class SampleModel
else
fdata = (float[])obj;
for (int i=y; i<y+h; i++) {
for (int j=x; j<x+w; j++) {
for (int i=y; i<y1; i++) {
for (int j=x; j<x1; j++) {
o = getDataElements(j, i, o, data);
ftemp = (float[])o;
for (int k=0; k<numDataElems; k++) {
......@@ -462,8 +471,8 @@ public abstract class SampleModel
else
ddata = (double[])obj;
for (int i=y; i<y+h; i++) {
for (int j=x; j<x+w; j++) {
for (int i=y; i<y1; i++) {
for (int j=x; j<x1; j++) {
o = getDataElements(j, i, o, data);
dtemp = (double[])o;
for (int k=0; k<numDataElems; k++) {
......
......@@ -335,9 +335,15 @@ public class RuleBasedCollator extends Collator{
* collation rules. Returns information about whether a string is less
* than, greater than or equal to another string in a language.
* This can be overriden in a subclass.
*
* @exception NullPointerException if <code>source</code> or <code>target</code> is null.
*/
public synchronized int compare(String source, String target)
{
if (source == null || target == null) {
throw new NullPointerException();
}
// The basic algorithm here is that we use CollationElementIterators
// to step through both the source and target strings. We compare each
// collation element in the source string against the corresponding one
......
......@@ -1715,6 +1715,7 @@ public final class Locale implements Cloneable, Serializable {
OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);
String languageName = getDisplayLanguage(inLocale);
String scriptName = getDisplayScript(inLocale);
String countryName = getDisplayCountry(inLocale);
String[] variantNames = getDisplayVariantArray(bundle, inLocale);
......@@ -1735,25 +1736,40 @@ public final class Locale implements Cloneable, Serializable {
String mainName = null;
String[] qualifierNames = null;
// The main name is the language, or if there is no language, the country.
// If there is neither language nor country (an anomalous situation) then
// the display name is simply the variant's display name.
if (languageName.length() != 0) {
mainName = languageName;
if (countryName.length() != 0) {
qualifierNames = new String[variantNames.length + 1];
System.arraycopy(variantNames, 0, qualifierNames, 1, variantNames.length);
qualifierNames[0] = countryName;
// The main name is the language, or if there is no language, the script,
// then if no script, the country. If there is no language/script/country
// (an anomalous situation) then the display name is simply the variant's
// display name.
if (languageName.length() == 0 && scriptName.length() == 0 && countryName.length() == 0) {
if (variantNames.length == 0) {
return "";
} else {
return formatList(variantNames, listPattern, listCompositionPattern);
}
else qualifierNames = variantNames;
}
else if (countryName.length() != 0) {
mainName = countryName;
qualifierNames = variantNames;
ArrayList<String> names = new ArrayList<String>(4);
if (languageName.length() != 0) {
names.add(languageName);
}
else {
return formatList(variantNames, listPattern, listCompositionPattern);
if (scriptName.length() != 0) {
names.add(scriptName);
}
if (countryName.length() != 0) {
names.add(countryName);
}
if (variantNames.length != 0) {
for (String var : variantNames) {
names.add(var);
}
}
// The first one in the main name
mainName = names.get(0);
// Others are qualifiers
int numNames = names.size();
qualifierNames = (numNames > 1) ?
names.subList(1, numNames).toArray(new String[numNames - 1]) : new String[0];
// Create an array whose first element is the number of remaining
// elements. This serves as a selector into a ChoiceFormat pattern from
......@@ -1941,7 +1957,7 @@ public final class Locale implements Cloneable, Serializable {
* @serialField variant String
* variant subtags separated by LOWLINE characters. (See <a href="java/util/Locale.html#getVariant()">getVariant()</a>)
* @serialField hashcode int
* deprectated, for forward compatibility only
* deprecated, for forward compatibility only
* @serialField script String
* script subtag in title case (See <a href="java/util/Locale.html#getScript()">getScript()</a>)
* @serialField extensions String
......@@ -1979,7 +1995,7 @@ public final class Locale implements Cloneable, Serializable {
}
/**
* Deserialize this <code>Locale</code>.
* Deserializes this <code>Locale</code>.
* @param in the <code>ObjectInputStream</code> to read
* @throws IOException
* @throws ClassNotFoundException
......
/*
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2010, 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
......@@ -302,60 +302,94 @@ abstract public class TimeZone implements Serializable, Cloneable {
}
/**
* Returns a name of this time zone suitable for presentation to the user
* in the default locale.
* This method returns the long name, not including daylight savings.
* If the display name is not available for the locale,
* then this method returns a string in the
* <a href="#NormalizedCustomID">normalized custom ID format</a>.
* Returns a long standard time name of this {@code TimeZone} suitable for
* presentation to the user in the default locale.
*
* <p>This method is equivalent to:
* <pre><blockquote>
* getDisplayName(false, {@link #LONG},
* Locale.getDefault({@link Locale.Category#DISPLAY}))
* </blockquote></pre>
*
* @return the human-readable name of this time zone in the default locale.
* @since 1.2
* @see #getDisplayName(boolean, int, Locale)
* @see Locale#getDefault(Locale.Category)
* @see Locale.Category
*/
public final String getDisplayName() {
return getDisplayName(false, LONG, Locale.getDefault(Locale.Category.DISPLAY));
return getDisplayName(false, LONG,
Locale.getDefault(Locale.Category.DISPLAY));
}
/**
* Returns a name of this time zone suitable for presentation to the user
* in the specified locale.
* This method returns the long name, not including daylight savings.
* If the display name is not available for the locale,
* then this method returns a string in the
* <a href="#NormalizedCustomID">normalized custom ID format</a>.
* Returns a long standard time name of this {@code TimeZone} suitable for
* presentation to the user in the specified {@code locale}.
*
* <p>This method is equivalent to:
* <pre><blockquote>
* getDisplayName(false, {@link #LONG}, locale)
* </blockquote></pre>
*
* @param locale the locale in which to supply the display name.
* @return the human-readable name of this time zone in the given locale.
* @exception NullPointerException if {@code locale} is {@code null}.
* @since 1.2
* @see #getDisplayName(boolean, int, Locale)
*/
public final String getDisplayName(Locale locale) {
return getDisplayName(false, LONG, locale);
}
/**
* Returns a name of this time zone suitable for presentation to the user
* in the default locale.
* If the display name is not available for the locale, then this
* method returns a string in the
* <a href="#NormalizedCustomID">normalized custom ID format</a>.
* @param daylight if true, return the daylight savings name.
* @param style either <code>LONG</code> or <code>SHORT</code>
* Returns a name in the specified {@code style} of this {@code TimeZone}
* suitable for presentation to the user in the default locale. If the
* specified {@code daylight} is {@code true}, a daylight saving time name
* is returned. Otherwise, a standard time name is returned.
*
* <p>This method is equivalent to:
* <pre><blockquote>
* getDisplayName(daylight, style,
* Locale.getDefault({@link Locale.Category#DISPLAY}))
* </blockquote></pre>
*
* @param daylight if {@code true}, return the daylight saving time name.
* @param style either {@link #LONG} or {@link #SHORT}
* @return the human-readable name of this time zone in the default locale.
* @exception IllegalArgumentException if {@code style} is invalid.
* @since 1.2
* @see #getDisplayName(boolean, int, Locale)
* @see Locale#getDefault(Locale.Category)
* @see Locale.Category
*/
public final String getDisplayName(boolean daylight, int style) {
return getDisplayName(daylight, style, Locale.getDefault(Locale.Category.DISPLAY));
return getDisplayName(daylight, style,
Locale.getDefault(Locale.Category.DISPLAY));
}
/**
* Returns a name of this time zone suitable for presentation to the user
* in the specified locale.
* If the display name is not available for the locale,
* then this method returns a string in the
* <a href="#NormalizedCustomID">normalized custom ID format</a>.
* @param daylight if true, return the daylight savings name.
* @param style either <code>LONG</code> or <code>SHORT</code>
* Returns a name in the specified {@code style} of this {@code TimeZone}
* suitable for presentation to the user in the specified {@code
* locale}. If the specified {@code daylight} is {@code true}, a daylight
* saving time name is returned. Otherwise, a standard time name is
* returned.
*
* <p>When looking up a time zone name, the {@linkplain
* ResourceBundle.Control#getCandidateLocales(String,Locale) default
* <code>Locale</code> search path of <code>ResourceBundle</code>} derived
* from the specified {@code locale} is used. (No {@linkplain
* ResourceBundle.Control#getFallbackLocale(String,Locale) fallback
* <code>Locale</code>} search is performed.) If a time zone name in any
* {@code Locale} of the search path, including {@link Locale#ROOT}, is
* found, the name is returned. Otherwise, a string in the
* <a href="#NormalizedCustomID">normalized custom ID format</a> is returned.
*
* @param daylight if {@code true}, return the daylight saving time name.
* @param style either {@link #LONG} or {@link #SHORT}
* @param locale the locale in which to supply the display name.
* @return the human-readable name of this time zone in the given locale.
* @exception IllegalArgumentException style is invalid.
* @exception IllegalArgumentException if {@code style} is invalid.
* @exception NullPointerException if {@code locale} is {@code null}.
* @since 1.2
*/
public String getDisplayName(boolean daylight, int style, Locale locale) {
......
......@@ -63,7 +63,7 @@ import com.sun.media.sound.JDK13Services;
* <p>Properties can be used to specify the default mixer
* for specific line types.
* Both system properties and a properties file are considered.
* In the Sun reference implementation, the properties file is
* In the Oracle reference implementation, the properties file is
* &quot;lib/sound.properties&quot; in the JRE
* directory. If a property exists both as a system property and in the
* properties file, the system property takes precedence. If none is
......
......@@ -29,6 +29,7 @@ import sun.awt.AWTAccessor;
import javax.swing.plaf.LayerUI;
import javax.swing.border.Border;
import javax.accessibility.*;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
......@@ -149,7 +150,7 @@ import java.security.PrivilegedAction;
*/
public final class JLayer<V extends Component>
extends JComponent
implements Scrollable, PropertyChangeListener {
implements Scrollable, PropertyChangeListener, Accessible {
private V view;
// this field is necessary because JComponent.ui is transient
// when layerUI is serializable
......@@ -665,6 +666,22 @@ public final class JLayer<V extends Component>
}
}
/**
* Gets the AccessibleContext associated with this {@code JLayer}.
*
* @return the AccessibleContext associated with this {@code JLayer}.
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJComponent() {
public AccessibleRole getAccessibleRole() {
return AccessibleRole.PANEL;
}
};
}
return accessibleContext;
}
/**
* static AWTEventListener to be shared with all AbstractLayerUIs
*/
......
......@@ -2491,7 +2491,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* The default value of this property is defined by the look
* and feel implementation.
* <p>
* This is a <a href="http://java.sun.com/docs/books/tutorial/javabeans/whatis/beanDefinition.html">JavaBeans</a> bound property.
* This is a <a href="http://java.sun.com/docs/books/tutorial/javabeans/properties/bound.html">JavaBeans</a> bound property.
*
* @param selectionForeground the <code>Color</code> to use in the foreground
* for selected list items
......@@ -2529,7 +2529,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* The default value of this property is defined by the look
* and feel implementation.
* <p>
* This is a <a href="http://java.sun.com/docs/books/tutorial/javabeans/whatis/beanDefinition.html">JavaBeans</a> bound property.
* This is a <a href="http://java.sun.com/docs/books/tutorial/javabeans/properties/bound.html">JavaBeans</a> bound property.
*
* @param selectionBackground the <code>Color</code> to use for the background
* of selected cells
......
......@@ -141,6 +141,22 @@ public class BasicFileChooserUI extends FileChooserUI {
private JPanel accessoryPanel = null;
private Handler handler;
/**
* Creates a {@code BasicFileChooserUI} implementation
* for the specified component. By default
* the {@code BasicLookAndFeel} class uses
* {@code createUI} methods of all basic UIs classes
* to instantiate UIs.
*
* @param c the {@code JFileChooser} which needs a UI
* @return the {@code BasicFileChooserUI} object
*
* @see UIDefaults#getUI(JComponent)
* @since 1.7
*/
public static ComponentUI createUI(JComponent c) {
return new BasicFileChooserUI((JFileChooser) c);
}
public BasicFileChooserUI(JFileChooser b) {
}
......
......@@ -269,6 +269,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel implements Serializab
"InternalFrameUI", basicPackageName + "BasicInternalFrameUI",
"DesktopPaneUI", basicPackageName + "BasicDesktopPaneUI",
"DesktopIconUI", basicPackageName + "BasicDesktopIconUI",
"FileChooserUI", basicPackageName + "BasicFileChooserUI",
"OptionPaneUI", basicPackageName + "BasicOptionPaneUI",
"PanelUI", basicPackageName + "BasicPanelUI",
"ViewportUI", basicPackageName + "BasicViewportUI",
......
......@@ -26,6 +26,7 @@
package sun.awt;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
......@@ -301,6 +302,24 @@ public final class AWTAccessor {
* Marks the event as posted.
*/
void setPosted(AWTEvent ev);
/**
* Sets the flag on this AWTEvent indicating that it was
* generated by the system.
*/
void setSystemGenerated(AWTEvent ev);
/**
* Indicates whether this AWTEvent was generated by the system.
*/
boolean isSystemGenerated(AWTEvent ev);
}
public interface InputEventAccessor {
/*
* Accessor for InputEvent.getButtonDownMasks()
*/
int[] getButtonDownMasks();
}
/*
......@@ -435,6 +454,11 @@ public final class AWTAccessor {
*/
private static AWTEventAccessor awtEventAccessor;
/*
* The java.awt.event.InputEvent class accessor object.
*/
private static InputEventAccessor inputEventAccessor;
/*
* The java.awt.Frame class accessor object.
*/
......@@ -517,6 +541,23 @@ public final class AWTAccessor {
return awtEventAccessor;
}
/*
* Set an accessor object for the java.awt.event.InputEvent class.
*/
public static void setInputEventAccessor(InputEventAccessor iea) {
inputEventAccessor = iea;
}
/*
* Retrieve the accessor object for the java.awt.event.InputEvent class.
*/
public static InputEventAccessor getInputEventAccessor() {
if (inputEventAccessor == null) {
unsafe.ensureClassInitialized(InputEvent.class);
}
return inputEventAccessor;
}
/*
* Set an accessor object for the java.awt.Frame class.
*/
......
......@@ -313,6 +313,11 @@ public abstract class SunToolkit extends Toolkit
*/
public static AppContext createNewAppContext() {
ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
// Create appContext before initialization of EventQueue, so all
// the calls to AppContext.getAppContext() from EventQueue ctor
// return correct values
AppContext appContext = new AppContext(threadGroup);
EventQueue eventQueue;
String eqName = System.getProperty("AWT.EventQueueClass",
"java.awt.EventQueue");
......@@ -322,7 +327,6 @@ public abstract class SunToolkit extends Toolkit
System.err.println("Failed loading " + eqName + ": " + e);
eventQueue = new EventQueue();
}
AppContext appContext = new AppContext(threadGroup);
appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue);
PostEventQueue postEventQueue = new PostEventQueue(eventQueue);
......@@ -587,6 +591,12 @@ public abstract class SunToolkit extends Toolkit
if (event == null) {
throw new NullPointerException();
}
// All events posted via this method are system-generated.
// Placing the following call here reduces considerably the
// number of places throughout the toolkit that would
// otherwise have to be modified to precisely identify
// system-generated events.
setSystemGenerated(event);
AppContext eventContext = targetToAppContext(event.getSource());
if (eventContext != null && !eventContext.equals(appContext)) {
log.fine("Event posted on wrong app context : " + event);
......@@ -2089,6 +2099,25 @@ public abstract class SunToolkit extends Toolkit
}
return isInstanceOf(cls.getSuperclass(), type);
}
///////////////////////////////////////////////////////////////////////////
//
// The following methods help set and identify whether a particular
// AWTEvent object was produced by the system or by user code. As of this
// writing the only consumer is the Java Plug-In, although this information
// could be useful to more clients and probably should be formalized in
// the public API.
//
///////////////////////////////////////////////////////////////////////////
public static void setSystemGenerated(AWTEvent e) {
AWTAccessor.getAWTEventAccessor().setSystemGenerated(e);
}
public static boolean isSystemGenerated(AWTEvent e) {
return AWTAccessor.getAWTEventAccessor().isSystemGenerated(e);
}
} // class SunToolkit
......
......@@ -84,7 +84,7 @@ public final class LocaleServiceProviderPool {
* static. This could be non-static later, so that they could have
* different sets for each locale sensitive services.
*/
private static List<Locale> availableJRELocales = null;
private static volatile List<Locale> availableJRELocales = null;
/**
* Provider locales for this locale sensitive service.
......@@ -252,12 +252,16 @@ public final class LocaleServiceProviderPool {
*
* @return list of the available JRE locales
*/
private synchronized List<Locale> getJRELocales() {
private List<Locale> getJRELocales() {
if (availableJRELocales == null) {
Locale[] allLocales = LocaleData.getAvailableLocales();
availableJRELocales = new ArrayList<Locale>(allLocales.length);
for (Locale locale : allLocales) {
availableJRELocales.add(getLookupLocale(locale));
synchronized (LocaleServiceProviderPool.class) {
if (availableJRELocales == null) {
Locale[] allLocales = LocaleData.getAvailableLocales();
availableJRELocales = new ArrayList<Locale>(allLocales.length);
for (Locale locale : allLocales) {
availableJRELocales.add(getLookupLocale(locale));
}
}
}
}
return availableJRELocales;
......
......@@ -3993,7 +3993,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
#ifdef PNG_FLOATING_POINT_SUPPORTED
#if defined(PNG_READ_GAMMA_SUPPORTED)
const static int png_gamma_shift[] =
static PNG_CONST int png_gamma_shift[] =
{0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00};
/* We build the 8- or 16-bit gamma tables here. Note that for 16-bit
......
......@@ -209,7 +209,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
png_charp chunkdata, png_size_t chunklength,
png_size_t prefix_size, png_size_t *newlength)
{
const static char msg[] = "Error decoding compressed text";
static PNG_CONST char msg[] = "Error decoding compressed text";
png_charp text;
png_size_t text_size;
......
......@@ -558,10 +558,11 @@ void mlib_ImageLookUp_S32_D64(const mlib_s32 *src,
const mlib_d64 **table)
{
const mlib_d64 *table_base[4];
mlib_u32 shift = TABLE_SHIFT_S32;
mlib_s32 c;
for (c = 0; c < csize; c++) {
table_base[c] = &table[c][TABLE_SHIFT_S32];
table_base[c] = &table[c][shift];
}
MLIB_C_IMAGELOOKUP(mlib_d64, mlib_s32, table_base);
......@@ -1039,10 +1040,11 @@ void mlib_ImageLookUpSI_S32_D64(const mlib_s32 *src,
const mlib_d64 **table)
{
const mlib_d64 *table_base[4];
mlib_u32 shift = TABLE_SHIFT_S32;
mlib_s32 c;
for (c = 0; c < csize; c++) {
table_base[c] = &table[c][TABLE_SHIFT_S32];
table_base[c] = &table[c][shift];
}
MLIB_C_IMAGELOOKUPSI(mlib_d64, mlib_s32, table_base);
......
......@@ -51,7 +51,7 @@ static const char szNetscape20ext[11] = "NETSCAPE2.0";
#define NSEXT_LOOP 0x01 // Loop Count field code
// convert libungif samples to our ones
#define MAKE_QUAD_GIF(c,a) MAKE_QUAD((c).Red, (c).Green, (c).Blue, (a))
#define MAKE_QUAD_GIF(c,a) MAKE_QUAD((c).Red, (c).Green, (c).Blue, (unsigned)(a))
/* stdio FILE* and memory input functions for libungif */
int
......@@ -165,7 +165,7 @@ SplashDecodeGif(Splash * splash, GifFileType * gif)
{
int flag = pExtension[0];
frameDelay = (pExtension[2] << 8) | pExtension[1];
frameDelay = (((int)pExtension[2]) << 8) | pExtension[1];
if (frameDelay < 10)
frameDelay = 10;
if (flag & GIF_TRANSPARENT) {
......@@ -191,7 +191,7 @@ SplashDecodeGif(Splash * splash, GifFileType * gif)
iSubCode = pExtension[0] & 0x07;
if (iSubCode == NSEXT_LOOP) {
splash->loopCount =
(pExtension[1] | (pExtension[2] << 8)) - 1;
(pExtension[1] | (((int)pExtension[2]) << 8)) - 1;
}
}
break;
......@@ -277,7 +277,7 @@ SplashDecodeGif(Splash * splash, GifFileType * gif)
ImageRect dstRect;
rgbquad_t fillColor = 0; // 0 is transparent
if (transparentColor > 0) {
if (transparentColor < 0) {
fillColor= MAKE_QUAD_GIF(
colorMap->Colors[gif->SBackGroundColor], 0xff);
}
......
......@@ -432,7 +432,7 @@ public abstract class InfoWindow extends Window {
ActionEvent aev = new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
liveArguments.getActionCommand(),
e.getWhen(), e.getModifiers());
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(aev);
XToolkit.postEvent(XToolkit.targetToAppContext(aev.getSource()), aev);
}
}
}
......
......@@ -87,11 +87,15 @@ abstract class XDecoratedPeer extends XWindowPeer {
}
void postInit(XCreateWindowParams params) {
// The size hints must be set BEFORE mapping the window (see 6895647)
updateSizeHints(dimensions);
// The super method maps the window if it's visible on the shared level
super.postInit(params);
// The lines that follow need to be in a postInit, so they
// happen after the X window is created.
initResizability();
updateSizeHints(dimensions);
XWM.requestWMExtents(getWindow());
content = XContentWindow.createContent(this);
......
......@@ -25,11 +25,15 @@
package sun.awt.X11;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.peer.*;
import sun.awt.X11GraphicsConfig;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.awt.X11GraphicsConfig;
class XRobotPeer implements RobotPeer {
private X11GraphicsConfig xgc = null;
/*
* native implementation uses some static shared data (pipes, processes)
......@@ -40,7 +44,7 @@ class XRobotPeer implements RobotPeer {
XRobotPeer(GraphicsConfiguration gc) {
this.xgc = (X11GraphicsConfig)gc;
SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
setup(tk.getNumberOfButtons());
setup(tk.getNumberOfButtons(), AWTAccessor.getInputEventAccessor().getButtonDownMasks());
}
public void dispose() {
......@@ -83,7 +87,7 @@ class XRobotPeer implements RobotPeer {
return pixelArray;
}
private static native synchronized void setup(int numberOfButtons);
private static native synchronized void setup(int numberOfButtons, int[] buttonDownMasks);
private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y);
private static native synchronized void mousePressImpl(int buttons);
......
......@@ -61,6 +61,7 @@ import javax.swing.plaf.BorderUIResource;
import java.awt.im.InputMethodRequests;
import sun.awt.CausedFocusEvent;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
......@@ -1318,13 +1319,18 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
Component source, Point point, MouseEvent template )
{
MouseEvent e = template;
return new MouseEvent(
MouseEvent nme = new MouseEvent(
source,
e.getID(), e.getWhen(),
e.getModifiersEx() | e.getModifiers(),
point.x, point.y,
e.getXOnScreen(), e.getYOnScreen(),
e.getClickCount(), e.isPopupTrigger(), e.getButton() );
// Because these MouseEvents are dispatched directly to
// their target, we need to mark them as being
// system-generated here
SunToolkit.setSystemGenerated(nme);
return nme;
}
private void setCursor() {
......
......@@ -377,22 +377,22 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
init();
XWM.init();
SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
toolkitThread = new Thread(this, "AWT-XAWT");
toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
toolkitThread.setDaemon(true);
ThreadGroup mainTG = (ThreadGroup)AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {
ThreadGroup currentTG =
Thread.currentThread().getThreadGroup();
ThreadGroup parentTG = currentTG.getParent();
while (parentTG != null) {
currentTG = parentTG;
parentTG = currentTG.getParent();
}
return currentTG;
}
});
PrivilegedAction<Thread> action = new PrivilegedAction() {
public Thread run() {
ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
ThreadGroup parentTG = currentTG.getParent();
while (parentTG != null) {
currentTG = parentTG;
parentTG = currentTG.getParent();
}
Thread thread = new Thread(currentTG, XToolkit.this, "AWT-XAWT");
thread.setPriority(Thread.NORM_PRIORITY + 1);
thread.setDaemon(true);
return thread;
}
};
toolkitThread = AccessController.doPrivileged(action);
toolkitThread.start();
}
}
......
......@@ -454,7 +454,7 @@ public class XTrayIconPeer implements TrayIconPeer,
ActionEvent aev = new ActionEvent(xtiPeer.target, ActionEvent.ACTION_PERFORMED,
xtiPeer.target.getActionCommand(), e.getWhen(),
e.getModifiers());
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(aev);
XToolkit.postEvent(XToolkit.targetToAppContext(aev.getSource()), aev);
}
if (xtiPeer.balloon.isVisible()) {
xtiPeer.balloon.hide();
......
......@@ -401,6 +401,8 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
if (isPostedField == null) {
isPostedField = SunToolkit.getField(AWTEvent.class, "isPosted");
}
// The uses of this method imply that the incoming event is system-generated
SunToolkit.setSystemGenerated(e);
PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() {
public void run() {
try {
......@@ -779,7 +781,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
xbe.get_x_root(),
xbe.get_y_root(),
1,false,MouseWheelEvent.WHEEL_UNIT_SCROLL,
3,button==4 ? -1*clickCount : 1*clickCount);
3,button==4 ? -1 : 1);
postEventToEventQueue(mwe);
}
}
......
......@@ -604,7 +604,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
public void handleWindowFocusIn_Dispatch() {
if (EventQueue.isDispatchThread()) {
XKeyboardFocusManagerPeer.setCurrentNativeFocusedWindow((Window) target);
target.dispatchEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS));
WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS);
SunToolkit.setSystemGenerated(we);
target.dispatchEvent(we);
}
}
......
......@@ -96,6 +96,7 @@ public abstract class X11InputMethod extends InputMethodAdapter {
private Component awtFocussedComponent = null;
private Component lastXICFocussedComponent = null;
private boolean isLastXICActive = false;
private boolean isLastTemporary = false;
private boolean isActive = false;
private boolean isActiveClient = false;
private static Map[] highlightStyles;
......@@ -349,7 +350,7 @@ public abstract class X11InputMethod extends InputMethodAdapter {
current focussed component, change the XIC focus to the newly
focussed component.
*/
if (lastXICFocussedComponentPeer != awtFocussedComponentPeer ||
if (isLastTemporary || lastXICFocussedComponentPeer != awtFocussedComponentPeer ||
isLastXICActive != haveActiveClient()) {
if (lastXICFocussedComponentPeer != null) {
setXICFocus(lastXICFocussedComponentPeer, false, isLastXICActive);
......@@ -401,6 +402,7 @@ public abstract class X11InputMethod extends InputMethodAdapter {
*/
lastXICFocussedComponent = awtFocussedComponent;
isLastXICActive = isAc;
isLastTemporary = isTemporary;
isActive = false;
}
......
......@@ -159,20 +159,8 @@ extern int lastL;
#endif /* DEBUG_AWT_LOCK && !XAWT */
#ifndef HEADLESS
extern Display *awt_display; /* awt_GraphicsEnv.c */
extern XtAppContext awt_appContext; /* awt_MToolkit.c */
extern Widget awt_root_shell;
extern Pixel awt_defaultBg;
extern Pixel awt_defaultFg;
extern int awt_multiclick_time; /* awt_MToolkit.c */
extern int awt_multiclick_smudge; /* canvas.c */
extern unsigned int awt_MetaMask; /* awt_MToolkit.c */
extern unsigned int awt_AltMask;
extern unsigned int awt_NumLockMask;
extern unsigned int awt_ModeSwitchMask;
extern Cursor awt_scrollCursor; /* awt_MToolkit.c */
extern Boolean awt_ModLockIsShiftLock;
extern Display *awt_display; /* awt_GraphicsEnv.c */
extern Boolean awt_ModLockIsShiftLock; /* XToolkit.c */
#endif /* !HEADLESS */
#endif /* ! _AWT_ */
......@@ -264,7 +264,7 @@ awt_DrawingSurface_GetDrawingSurfaceInfo(JAWT_DrawingSurface* ds)
#ifndef XAWT
px->drawable = XtWindow(cdata->widget);
#else
px->drawable = JNU_GetLongFieldAsPtr(env, peer, windowID);
px->drawable = (*env)->GetLongField(env, peer, windowID);
#endif
px->display = awt_display;
......
......@@ -46,8 +46,6 @@
#ifdef XAWT
#include <sun_awt_X11_XComponentPeer.h>
#include <sun_awt_X11_XInputMethod.h>
#define XtWindow(w) (w)
#else /* !XAWT */
#include <sun_awt_motif_MComponentPeer.h>
#include <sun_awt_motif_MInputMethod.h>
......@@ -670,7 +668,8 @@ static StatusWindow *createStatusWindow(
int mccr = 0;
char *dsr;
Pixel bg, fg, light, dim;
int x, y, w, h, bw, depth, off_x, off_y, xx, yy;
int x, y, off_x, off_y, xx, yy;
unsigned int w, h, bw, depth;
XGCValues values;
unsigned long valuemask = 0; /*ignore XGCvalue and use defaults*/
int screen = 0;
......@@ -709,7 +708,7 @@ static StatusWindow *createStatusWindow(
light = adata->AwtColorMatch(195, 195, 195, adata);
dim = adata->AwtColorMatch(128, 128, 128, adata);
XGetWindowAttributes(dpy, XtWindow(parent), &xwa);
XGetWindowAttributes(dpy, parent, &xwa);
bw = 2; /*xwa.border_width does not have the correct value*/
/*compare the size difference between parent container
......@@ -717,7 +716,7 @@ static StatusWindow *createStatusWindow(
and title bar height (?)*/
XQueryTree( dpy,
XtWindow(parent),
parent,
&rootWindow,
&containerWindow,
&ignoreWindowPtr,
......@@ -731,7 +730,7 @@ static StatusWindow *createStatusWindow(
XGetWindowAttributes(dpy, rootWindow, &xxwa);
XTranslateCoordinates(dpy,
XtWindow(parent), xwa.root,
parent, xwa.root,
xwa.x, xwa.y,
&x, &y,
&child);
......@@ -833,9 +832,9 @@ static void onoffStatusWindow(X11InputMethodData* pX11IMData,
if (statusWindow->parent != parent){
statusWindow->parent = parent;
}
XGetWindowAttributes(dpy, XtWindow(parent), &xwa);
XGetWindowAttributes(dpy, parent, &xwa);
XTranslateCoordinates(dpy,
XtWindow(parent), xwa.root,
parent, xwa.root,
xwa.x, xwa.y,
&x, &y,
&child);
......@@ -966,9 +965,9 @@ void adjustStatusWindow(Widget shell){
XWindowAttributes xwa;
int x, y;
Window child;
XGetWindowAttributes(dpy, XtWindow(shell), &xwa);
XGetWindowAttributes(dpy, shell, &xwa);
XTranslateCoordinates(dpy,
XtWindow(shell), xwa.root,
shell, xwa.root,
xwa.x, xwa.y,
&x, &y,
&child);
......@@ -1033,7 +1032,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
return False;
}
#ifdef XAWT
if (w == NULL) {
if (!w) {
return False;
}
#else /* !XAWT */
......@@ -1148,8 +1147,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
goto err;
pX11IMData->statusWindow = createStatusWindow(w);
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(w),
XNFocusWindow, XtWindow(w),
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, active_styles,
XNPreeditAttributes, preedit,
XNStatusAttributes, status,
......@@ -1166,8 +1165,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
goto err;
pX11IMData->statusWidget = awt_util_getXICStatusAreaWindow(w);
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(pX11IMData->statusWidget),
XNFocusWindow, XtWindow(w),
XNClientWindow, pX11IMData->statusWidget,
XNFocusWindow, w,
XNInputStyle, active_styles,
XNPreeditAttributes, preedit,
XNStatusAttributes, status,
......@@ -1176,8 +1175,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
} else {
#endif /* XAWT */
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(w),
XNFocusWindow, XtWindow(w),
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, active_styles,
XNPreeditAttributes, preedit,
NULL);
......@@ -1187,15 +1186,15 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
XFree((void *)preedit);
#endif /* __linux__ */
pX11IMData->ic_passive = XCreateIC(X11im,
XNClientWindow, XtWindow(w),
XNFocusWindow, XtWindow(w),
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, passive_styles,
NULL);
} else {
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(w),
XNFocusWindow, XtWindow(w),
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, active_styles,
NULL);
pX11IMData->ic_passive = pX11IMData->ic_active;
......@@ -1213,7 +1212,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
{
XIMCallback cb;
cb.client_data = (XPointer) pX11IMData->x11inputmethod;
cb.callback = CommitStringCallback;
cb.callback = (XIMProc) CommitStringCallback;
XSetICValues (pX11IMData->ic_active, XNCommitStringCallback, &cb, NULL);
if (pX11IMData->ic_active != pX11IMData->ic_passive) {
XSetICValues (pX11IMData->ic_passive, XNCommitStringCallback, &cb, NULL);
......@@ -1510,7 +1509,7 @@ Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env,
AWT_LOCK();
#ifdef XAWT
dpy = (Display *)display;
dpy = (Display *)jlong_to_ptr(display);
#else
dpy = awt_display;
#endif
......@@ -1520,7 +1519,7 @@ Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env,
*/
#ifdef __linux__
registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL,
NULL, (XIMProc)OpenXIMCallback, NULL);
NULL, (XIDProc)OpenXIMCallback, NULL);
if (!registered) {
/* directly call openXIM callback */
#endif
......@@ -1555,7 +1554,7 @@ Java_sun_awt_motif_MInputMethod_createXICNative(JNIEnv *env,
AWT_LOCK();
#ifdef XAWT
if (window == NULL) {
if (!window) {
#else /* !XAWT */
if (JNU_IsNull(env, comp)) {
#endif /* XAWT */
......@@ -1664,7 +1663,7 @@ Java_sun_awt_motif_MInputMethod_reconfigureXICNative(JNIEnv *env,
* On Solaris2.6, setXICWindowFocus() has to be invoked
* before setting focus.
*/
setXICWindowFocus(pX11IMData->current_ic, XtWindow(cdata->widget));
setXICWindowFocus(pX11IMData->current_ic, cdata->widget);
setXICFocus(pX11IMData->current_ic, True);
} else {
destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData);
......@@ -1705,7 +1704,7 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
if (req) {
#ifdef XAWT
if (w == NULL) {
if (!w) {
AWT_UNLOCK();
return;
}
......@@ -1738,10 +1737,10 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
#ifndef XAWT
w = cdata->widget;
#endif /* XAWT */
setXICWindowFocus(pX11IMData->current_ic, XtWindow(w));
setXICWindowFocus(pX11IMData->current_ic, w);
setXICFocus(pX11IMData->current_ic, req);
currentX11InputMethodInstance = pX11IMData->x11inputmethod;
currentFocusWindow = XtWindow(w);
currentFocusWindow = w;
#ifdef __linux__
if (active && pX11IMData->statusWindow && pX11IMData->statusWindow->on)
onoffStatusWindow(pX11IMData, w, True);
......
......@@ -165,41 +165,34 @@ static XImage *getWindowImage(Display * display, Window window,
// this should be called from XRobotPeer constructor
JNIEXPORT void JNICALL
Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons) {
Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons, jintArray buttonDownMasks)
{
int32_t xtestAvailable;
jint *tmp;
int i;
DTRACE_PRINTLN("RobotPeer: setup()");
num_buttons = numberOfButtons;
jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
masks = (jint *)malloc(sizeof(jint) * num_buttons);
tmp = (*env)->GetIntArrayElements(env, buttonDownMasks, JNI_FALSE);
masks = (jint *)malloc(sizeof(jint) * num_buttons);
if (masks == (jint *) NULL) {
JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL);
goto finally;
(*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
return;
}
int i;
for (i = 0; i < num_buttons; i++) {
masks[i] = tmp[i];
}
(*env)->ReleaseIntArrayElements(env, obj, tmp, 0);
(*env)->DeleteLocalRef(env, obj);
(*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
AWT_LOCK();
xtestAvailable = isXTestAvailable();
DTRACE_PRINTLN1("RobotPeer: XTest available = %d", xtestAvailable);
if (!xtestAvailable) {
JNU_ThrowByName(env, "java/awt/AWTException", "java.awt.Robot requires your X server support the XTEST extension version 2.2");
AWT_UNLOCK();
return;
}
finally:
AWT_UNLOCK();
}
......
......@@ -112,7 +112,7 @@ jboolean _icon_upcall(JNIEnv *env, jobject this, GdkPixbuf *pixbuf)
/* Copy the data array into a Java structure so we can pass it back. */
jbyteArray data = (*env)->NewByteArray(env, (row_stride * height));
(*env)->SetByteArrayRegion(env, data, 0, (row_stride * height),
pixbuf_data);
(jbyte *)pixbuf_data);
/* Release the pixbuf. */
(*fp_g_object_unref)(pixbuf);
......
......@@ -169,7 +169,8 @@ void mlib_v_ImageLookUp_S32_S16_1(const mlib_s32 * src,
{
mlib_s32 *sl;
mlib_s16 *dl;
const mlib_s16 *tab = &table[0][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab = &table[0][shift];
mlib_s32 j, i;
sl = (void *)src;
......@@ -209,6 +210,7 @@ void mlib_v_ImageLookUp_S32_S16_2(const mlib_s32 * src,
{
mlib_s32 *sl;
mlib_s16 *dl;
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab;
mlib_s32 j, i;
......@@ -220,8 +222,8 @@ void mlib_v_ImageLookUp_S32_S16_2(const mlib_s32 * src,
mlib_s32 *sp = sl;
mlib_s16 *dp = dl;
mlib_s32 off, size = xsize * 2;
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
......@@ -261,6 +263,7 @@ void mlib_v_ImageLookUp_S32_S16_4(const mlib_s32 * src,
{
mlib_s32 *sl;
mlib_s16 *dl;
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab;
mlib_s32 j;
......@@ -271,10 +274,10 @@ void mlib_v_ImageLookUp_S32_S16_4(const mlib_s32 * src,
for (j = 0; j < ysize; j++) {
mlib_s32 *sp = sl;
mlib_s16 *dp = dl;
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_s16 *tab3 = &table[3][(mlib_u32) 2147483648u];
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
const mlib_s16 *tab2 = &table[2][shift];
const mlib_s16 *tab3 = &table[3][shift];
mlib_s32 off, size = xsize * 4;
off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
......@@ -453,6 +456,7 @@ void mlib_v_ImageLookUp_S32_S16_3(const mlib_s32 * src,
{
mlib_s32 *sl;
mlib_s16 *dl;
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab;
mlib_s32 j, i;
......@@ -463,9 +467,9 @@ void mlib_v_ImageLookUp_S32_S16_3(const mlib_s32 * src,
for (j = 0; j < ysize; j++) {
mlib_s32 *sp = sl;
mlib_s16 *dp = dl;
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
const mlib_s16 *tab2 = &table[2][shift];
mlib_s32 off, size = xsize * 3;
off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
......
......@@ -170,7 +170,8 @@ void mlib_v_ImageLookUp_S32_U16_1(const mlib_s32 *src,
{
mlib_s32 *sl;
mlib_u16 *dl;
const mlib_u16 *tab = &table[0][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab = &table[0][shift];
mlib_s32 j, i;
sl = (void *)src;
......@@ -211,6 +212,7 @@ void mlib_v_ImageLookUp_S32_U16_2(const mlib_s32 *src,
{
mlib_s32 *sl;
mlib_u16 *dl;
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab;
mlib_s32 j, i;
......@@ -222,8 +224,8 @@ void mlib_v_ImageLookUp_S32_U16_2(const mlib_s32 *src,
mlib_s32 *sp = sl;
mlib_u16 *dp = dl;
mlib_s32 off, size = xsize * 2;
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
......@@ -264,6 +266,7 @@ void mlib_v_ImageLookUp_S32_U16_4(const mlib_s32 *src,
{
mlib_s32 *sl;
mlib_u16 *dl;
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab;
mlib_s32 j;
......@@ -274,10 +277,10 @@ void mlib_v_ImageLookUp_S32_U16_4(const mlib_s32 *src,
for (j = 0; j < ysize; j++) {
mlib_s32 *sp = sl;
mlib_u16 *dp = dl;
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_u16 *tab3 = &table[3][(mlib_u32) 2147483648u];
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
const mlib_u16 *tab2 = &table[2][shift];
const mlib_u16 *tab3 = &table[3][shift];
mlib_s32 off, size = xsize * 4;
off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
......@@ -457,6 +460,7 @@ void mlib_v_ImageLookUp_S32_U16_3(const mlib_s32 *src,
{
mlib_s32 *sl;
mlib_u16 *dl;
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab;
mlib_s32 j, i;
......@@ -467,9 +471,9 @@ void mlib_v_ImageLookUp_S32_U16_3(const mlib_s32 *src,
for (j = 0; j < ysize; j++) {
mlib_s32 *sp = sl;
mlib_u16 *dp = dl;
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
const mlib_u16 *tab2 = &table[2][shift];
mlib_s32 off, size = xsize * 3;
off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
......
......@@ -81,8 +81,9 @@ void mlib_v_ImageLookUpSI_S32_S16_2_DstA8D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2; /* destination data */
mlib_d64 t3, acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
sp = (void *)src;
dl = dst;
......@@ -145,8 +146,9 @@ void mlib_v_ImageLookUpSI_S32_S16_2_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2; /* destination data */
mlib_d64 t3, acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
sp = (void *)src;
dl = dst;
......@@ -220,8 +222,9 @@ void mlib_v_ImageLookUpSI_S32_S16_2(const mlib_s32 *src,
mlib_s32 *sl;
mlib_s16 *dl;
mlib_s32 j;
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
sl = (void *)src;
dl = dst;
......@@ -268,9 +271,10 @@ void mlib_v_ImageLookUpSI_S32_S16_3_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2, t3; /* destination data */
mlib_d64 acc0, acc1, acc2; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
const mlib_s16 *tab2 = &table[2][shift];
mlib_s32 s00, s01, s02, s03;
sp = (void *)src;
......@@ -379,9 +383,10 @@ void mlib_v_ImageLookUpSI_S32_S16_3(const mlib_s32 *src,
mlib_s32 *sl;
mlib_s16 *dl;
mlib_s32 i, j;
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
const mlib_s16 *tab2 = &table[2][shift];
sl = (void *)src;
dl = dst;
......@@ -425,10 +430,11 @@ void mlib_v_ImageLookUpSI_S32_S16_4_DstOff0_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2, t3; /* destination data */
mlib_d64 acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_s16 *tab3 = &table[3][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
const mlib_s16 *tab2 = &table[2][shift];
const mlib_s16 *tab3 = &table[3][shift];
sp = (void *)src;
dl = dst;
......@@ -479,10 +485,11 @@ void mlib_v_ImageLookUpSI_S32_S16_4_DstOff1_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2, t3; /* destination data */
mlib_d64 acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_s16 *tab3 = &table[3][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
const mlib_s16 *tab2 = &table[2][shift];
const mlib_s16 *tab3 = &table[3][shift];
sp = (void *)src;
dl = dst;
......@@ -543,10 +550,11 @@ void mlib_v_ImageLookUpSI_S32_S16_4_DstOff2_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2, t3; /* destination data */
mlib_d64 acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_s16 *tab3 = &table[3][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
const mlib_s16 *tab2 = &table[2][shift];
const mlib_s16 *tab3 = &table[3][shift];
sp = (void *)src;
dl = dst;
......@@ -606,10 +614,11 @@ void mlib_v_ImageLookUpSI_S32_S16_4_DstOff3_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2, t3; /* destination data */
mlib_d64 acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_s16 *tab3 = &table[3][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
const mlib_s16 *tab2 = &table[2][shift];
const mlib_s16 *tab3 = &table[3][shift];
sp = (void *)src;
dl = dst;
......@@ -667,9 +676,10 @@ void mlib_v_ImageLookUpSI_S32_S16_4(const mlib_s32 *src,
mlib_s32 *sl;
mlib_s16 *dl;
mlib_s32 j;
const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_s16 *tab0 = &table[0][shift];
const mlib_s16 *tab1 = &table[1][shift];
const mlib_s16 *tab2 = &table[2][shift];
sl = (void *)src;
dl = dst;
......
......@@ -81,8 +81,9 @@ void mlib_v_ImageLookUpSI_S32_U16_2_DstA8D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2; /* destination data */
mlib_d64 t3, acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
sp = (void *)src;
dl = dst;
......@@ -145,8 +146,9 @@ void mlib_v_ImageLookUpSI_S32_U16_2_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2; /* destination data */
mlib_d64 t3, acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
sp = (void *)src;
dl = dst;
......@@ -220,8 +222,9 @@ void mlib_v_ImageLookUpSI_S32_U16_2(const mlib_s32 *src,
mlib_s32 *sl;
mlib_u16 *dl;
mlib_s32 j;
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
sl = (void *)src;
dl = dst;
......@@ -268,9 +271,10 @@ void mlib_v_ImageLookUpSI_S32_U16_3_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2, t3; /* destination data */
mlib_d64 acc0, acc1, acc2; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
const mlib_u16 *tab2 = &table[2][shift];
mlib_s32 s00, s01, s02, s03;
sp = (void *)src;
......@@ -379,9 +383,10 @@ void mlib_v_ImageLookUpSI_S32_U16_3(const mlib_s32 *src,
mlib_s32 *sl;
mlib_u16 *dl;
mlib_s32 i, j;
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
const mlib_u16 *tab2 = &table[2][shift];
sl = (void *)src;
dl = dst;
......@@ -425,10 +430,11 @@ void mlib_v_ImageLookUpSI_S32_U16_4_DstOff0_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2, t3; /* destination data */
mlib_d64 acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_u16 *tab3 = &table[3][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
const mlib_u16 *tab2 = &table[2][shift];
const mlib_u16 *tab3 = &table[3][shift];
sp = (void *)src;
dl = dst;
......@@ -479,10 +485,11 @@ void mlib_v_ImageLookUpSI_S32_U16_4_DstOff1_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2, t3; /* destination data */
mlib_d64 acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_u16 *tab3 = &table[3][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
const mlib_u16 *tab2 = &table[2][shift];
const mlib_u16 *tab3 = &table[3][shift];
sp = (void *)src;
dl = dst;
......@@ -543,10 +550,11 @@ void mlib_v_ImageLookUpSI_S32_U16_4_DstOff2_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2, t3; /* destination data */
mlib_d64 acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_u16 *tab3 = &table[3][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
const mlib_u16 *tab2 = &table[2][shift];
const mlib_u16 *tab3 = &table[3][shift];
sp = (void *)src;
dl = dst;
......@@ -606,10 +614,11 @@ void mlib_v_ImageLookUpSI_S32_U16_4_DstOff3_D1(const mlib_s32 *src,
mlib_d64 t0, t1, t2, t3; /* destination data */
mlib_d64 acc; /* destination data */
mlib_s32 i; /* loop variable */
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
const mlib_u16 *tab3 = &table[3][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
const mlib_u16 *tab2 = &table[2][shift];
const mlib_u16 *tab3 = &table[3][shift];
sp = (void *)src;
dl = dst;
......@@ -667,9 +676,10 @@ void mlib_v_ImageLookUpSI_S32_U16_4(const mlib_s32 *src,
mlib_s32 *sl;
mlib_u16 *dl;
mlib_s32 j;
const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
mlib_u32 shift = 2147483648u;
const mlib_u16 *tab0 = &table[0][shift];
const mlib_u16 *tab1 = &table[1][shift];
const mlib_u16 *tab2 = &table[2][shift];
sl = (void *)src;
dl = dst;
......
......@@ -484,8 +484,8 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion
(JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out)
{
AWT_CHECK_HAVE_LOCK();
*((int *)lib_major_in_out) = XkbMajorVersion;
*((int *)lib_minor_in_out) = XkbMinorVersion;
*((int *)jlong_to_ptr(lib_major_in_out)) = XkbMajorVersion;
*((int *)jlong_to_ptr(lib_minor_in_out)) = XkbMinorVersion;
return XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out));
}
......@@ -1229,7 +1229,6 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard
(JNIEnv *env, jclass clazz, jlong display)
{
int xx;
AWT_CHECK_HAVE_LOCK();
static jboolean result = JNI_FALSE;
int32_t minKeyCode, maxKeyCode, keySymsPerKeyCode;
......@@ -1237,6 +1236,8 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard
int32_t i;
int32_t kanaCount = 0;
AWT_CHECK_HAVE_LOCK();
// There's no direct way to determine whether the keyboard has
// a kana lock key. From available keyboard mapping tables, it looks
// like only keyboards with the kana lock key can produce keysyms
......@@ -1337,12 +1338,14 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms
(JNIEnv *env, jclass clazz, jlong display, jobjectArray names_arr, jboolean only_if_exists, jlong atoms)
{
int length = (*env)->GetArrayLength(env, names_arr);
char ** names = (char**)malloc(length*sizeof(char*));
jboolean copy;
int index, name_index = 0;
int status;
AWT_CHECK_HAVE_LOCK();
for (index = 0; index < length; index++) {
jstring str = (*env)->GetObjectArrayElement(env, names_arr, index);
if (!JNU_IsNull(env, str)) {
......@@ -1352,7 +1355,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms
(*env)->DeleteLocalRef(env, str);
}
}
AWT_CHECK_HAVE_LOCK();
status = XInternAtoms((Display*)jlong_to_ptr(display), names, name_index, only_if_exists, (Atom*) jlong_to_ptr(atoms));
for (index = 0; index < length; index++) {
free(names[index]);
......@@ -2186,12 +2188,12 @@ JNIEXPORT void JNICALL
Java_sun_awt_X11_XlibWrapper_SetZOrder
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong above)
{
AWT_CHECK_HAVE_LOCK();
unsigned int value_mask = CWStackMode;
XWindowChanges wc;
wc.sibling = (Window)jlong_to_ptr(above);
unsigned int value_mask = CWStackMode;
AWT_CHECK_HAVE_LOCK();
if (above == 0) {
wc.stack_mode = Above;
......@@ -2219,6 +2221,7 @@ Java_sun_awt_X11_XlibWrapper_SetBitmapShape
jboolean isCopy = JNI_FALSE;
size_t worstBufferSize = (size_t)((width / 2 + 1) * height);
RECT_T * pRect;
int numrects;
AWT_CHECK_HAVE_LOCK();
......@@ -2237,7 +2240,7 @@ Java_sun_awt_X11_XlibWrapper_SetBitmapShape
/* Note: the values[0] and values[1] are supposed to contain the width
* and height (see XIconInfo.getIntData() for details). So, we do +2.
*/
int numrects = BitmapToYXBandedRectangles(32, (int)width, (int)height,
numrects = BitmapToYXBandedRectangles(32, (int)width, (int)height,
(unsigned char *)(values + 2), pRect);
XShapeCombineRectangles((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window),
......
......@@ -28,12 +28,15 @@
typedef int gboolean;
gboolean (*gnome_url_show) (const char *url, void **error);
typedef gboolean (GNOME_URL_SHOW_TYPE)(const char *, void **);
typedef gboolean (GNOME_VFS_INIT_TYPE)(void);
GNOME_URL_SHOW_TYPE *gnome_url_show;
GNOME_VFS_INIT_TYPE *gnome_vfs_init;
int init(){
void *vfs_handle;
void *gnome_handle;
gboolean (*gnome_vfs_init) (void);
const char *errmsg;
vfs_handle = dlopen("libgnomevfs-2.so.0", RTLD_LAZY);
......@@ -44,7 +47,7 @@ int init(){
return 0;
}
dlerror(); /* Clear errors */
gnome_vfs_init = dlsym(vfs_handle, "gnome_vfs_init");
gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
if ((errmsg = dlerror()) != NULL) {
#ifdef INTERNAL_BUILD
fprintf(stderr, "can not find symble gnome_vfs_init\n");
......@@ -62,7 +65,7 @@ int init(){
return 0;
}
dlerror(); /* Clear errors */
gnome_url_show = dlsym(gnome_handle, "gnome_url_show");
gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");
if ((errmsg = dlerror()) != NULL) {
#ifdef INTERNAL_BUILD
fprintf(stderr, "can not find symble gnome_url_show\n");
......@@ -94,14 +97,15 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XDesktopPeer_gnome_1url_1show
(JNIEnv *env, jobject obj, jbyteArray url_j)
{
gboolean success;
const char* url_c;
const char* url_c = (*env)->GetByteArrayElements(env, url_j, NULL);
if (gnome_url_show == NULL) return JNI_FALSE;
if (gnome_url_show == NULL) {
return JNI_FALSE;
}
url_c = (char*)(*env)->GetByteArrayElements(env, url_j, NULL);
// call gnome_url_show(const char* , GError**)
success = (*gnome_url_show)(url_c, NULL);
(*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0);
return success ? JNI_TRUE : JNI_FALSE;
......
......@@ -33,6 +33,7 @@ import java.util.*;
import java.awt.color.*;
import java.awt.image.*;
import sun.awt.image.ByteInterleavedRaster;
import sun.security.action.GetPropertyAction;
import java.lang.reflect.*;
public class WEmbeddedFrame extends EmbeddedFrame {
......@@ -48,8 +49,12 @@ public class WEmbeddedFrame extends EmbeddedFrame {
private int imgWid = 0;
private int imgHgt = 0;
private static int pScale = 0;
private static final int MAX_BAND_SIZE = (1024*30);
private static String printScale = (String) java.security.AccessController
.doPrivileged(new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
public WEmbeddedFrame() {
this((long)0);
}
......@@ -114,8 +119,7 @@ public class WEmbeddedFrame extends EmbeddedFrame {
* real resolution of the destination so
*/
if (isPrinterDC(hdc)) {
xscale = 4;
yscale = 4;
xscale = yscale = getPrintScaleFactor();
}
int frameHeight = getHeight();
......@@ -168,6 +172,37 @@ public class WEmbeddedFrame extends EmbeddedFrame {
}
}
protected static int getPrintScaleFactor() {
// check if value is already cached
if (pScale != 0)
return pScale;
if (printScale == null) {
// if no system property is specified,
// check for environment setting
printScale = (String) java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
public Object run() {
return System.getenv("JAVA2D_PLUGIN_PRINT_SCALE");
}
}
);
}
int default_printDC_scale = 4;
int scale = default_printDC_scale;
if (printScale != null) {
try {
scale = Integer.parseInt(printScale);
if (scale > 8 || scale < 1) {
scale = default_printDC_scale;
}
} catch (NumberFormatException nfe) {
}
}
pScale = scale;
return pScale;
}
protected native boolean isPrinterDC(long hdc);
protected native void printBand(long hdc, byte[] data, int offset,
......
......@@ -487,13 +487,8 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
newDev.addDisplayChangedListener(this);
}
SunToolkit.executeOnEventHandlerThread((Component)target,
new Runnable() {
public void run() {
AWTAccessor.getComponentAccessor().
AWTAccessor.getComponentAccessor().
setGraphicsConfiguration((Component)target, winGraphicsConfig);
}
});
}
/**
......
......@@ -639,7 +639,7 @@ static BOOL IsDCPostscript( HDC hDC )
if( ::ExtEscape( hDC, GETTECHNOLOGY, 0, NULL, MAX_PATH,
(LPSTR)szTechnology ) <= 0 )
return FALSE;
strupr( szTechnology );
_strupr_s(szTechnology, MAX_PATH);
if(!strstr( szTechnology, "POSTSCRIPT" ) == NULL )
return TRUE;
......
......@@ -246,7 +246,7 @@ HRGN BitmapUtil::BitmapToRgn(HBITMAP hBitmap)
UINT height = abs(bi.bmiHeader.biHeight);
BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
bi.bmiHeader.biHeight = -height;
bi.bmiHeader.biHeight = -(INT)height;
::GetDIBits(hdc, hBitmap, 0, height, buf,
reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
......@@ -305,7 +305,7 @@ HBITMAP BitmapUtil::BlendCopy(HBITMAP hSrcBitmap, COLORREF blendColor,
UINT height = abs(bi.bmiHeader.biHeight);
BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
bi.bmiHeader.biHeight = -height;
bi.bmiHeader.biHeight = -(INT)height;
::GetDIBits(hdc, hSrcBitmap, 0, height, buf,
reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
......
......@@ -238,7 +238,7 @@ void AwtDesktopProperties::GetNonClientParameters() {
// when running on XP. However this can't be referenced at compile time
// with the older SDK, so there use 'lfMessageFont' plus its size.
if (!IS_WINVISTA) {
#if defined(_MSC_VER) && (_MSC_VER >= 1600) {
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
ncmetrics.cbSize = offsetof(NONCLIENTMETRICS, iPaddedBorderWidth);
#else
ncmetrics.cbSize = offsetof(NONCLIENTMETRICS,lfMessageFont) + sizeof(LOGFONT);
......
......@@ -304,7 +304,15 @@ void AwtDialog::PopupOneDialog(HWND dialog, HWND blocker, BOOL isModalHook, HWND
UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
if (isBlocked) {
::SetWindowPos(dialog, blocker, 0, 0, 0, 0, flags);
// Fix for 6829546: if blocker is a top-most window, but window isn't, then
// calling ::SetWindowPos(dialog, blocker, ...) makes window top-most as well
BOOL isBlockerTopmost = (::GetWindowLong(blocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
BOOL isDialogTopmost = (::GetWindowLong(dialog, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
if (!isBlockerTopmost || isDialogTopmost) {
::SetWindowPos(dialog, blocker, 0, 0, 0, 0, flags);
} else {
::SetWindowPos(dialog, HWND_TOP, 0, 0, 0, 0, flags);
}
} else {
::SetWindowPos(dialog, HWND_TOP, 0, 0, 0, 0, flags);
// no beep/flash if the mouse was clicked in the taskbar menu
......
......@@ -159,7 +159,8 @@ extern "C" {
void JNICALL DSUnlockAWT(JNIEnv* env);
_JNI_IMPORT_OR_EXPORT_
jobject JNICALL DSGetComponent(JNIEnv* env, void* platformInfo);
jobject JNICALL DSGetComponent(
JNIEnv* env, void* platformInfo);
#ifdef __cplusplus
} /* extern "C" */
......
......@@ -1189,7 +1189,7 @@ LONG AwtFontCache::DecRefCount(Item* item){
AwtFontCache::Item::Item(const WCHAR* s, HFONT f, AwtFontCache::Item* n )
{
name = wcsdup(s);
name = _wcsdup(s);
font = f;
next = n;
refCount = 1;
......@@ -1237,7 +1237,7 @@ void CSegTableComponent::Create(LPCWSTR name)
free(m_lpszFontName);
m_lpszFontName = NULL;
}
m_lpszFontName = wcsdup(name);
m_lpszFontName = _wcsdup(name);
DASSERT(m_lpszFontName);
}
......
......@@ -1050,7 +1050,7 @@ static LPTSTR GetPrinterPort(JNIEnv *env, LPTSTR printer) {
return NULL;
}
LPTSTR port = wcsdup(info2->pPortName);
LPTSTR port = _wcsdup(info2->pPortName);
::GlobalFree(info2);
return port;
}
......
......@@ -23,16 +23,12 @@
* questions.
*/
#define _JNI_IMPLEMENTATION_
#include "awt.h"
#include <signal.h>
#include <windowsx.h>
//#if defined(_DEBUG) && defined(_MSC_VER) && _MSC_VER >= 1000
//#include <crtdbg.h>
//#endif
#define _JNI_IMPLEMENTATION_
#include "awt_DrawingSurface.h"
#include "awt_AWTEvent.h"
#include "awt_Component.h"
......@@ -2224,21 +2220,21 @@ Java_sun_awt_windows_WToolkit_getWindowsVersion(JNIEnv *env, jclass cls)
WCHAR szVer[128];
DWORD version = ::GetVersion();
swprintf(szVer, L"0x%x = %ld", version, version);
swprintf(szVer, 128, L"0x%x = %ld", version, version);
int l = lstrlen(szVer);
if (IS_WIN2000) {
if (IS_WINXP) {
if (IS_WINVISTA) {
swprintf(szVer + l, L" (Windows Vista)");
swprintf(szVer + l, 128, L" (Windows Vista)");
} else {
swprintf(szVer + l, L" (Windows XP)");
swprintf(szVer + l, 128, L" (Windows XP)");
}
} else {
swprintf(szVer + l, L" (Windows 2000)");
swprintf(szVer + l, 128, L" (Windows 2000)");
}
} else {
swprintf(szVer + l, L" (Unknown)");
swprintf(szVer + l, 128, L" (Unknown)");
}
return JNU_NewStringPlatform(env, szVer);
......
......@@ -269,7 +269,7 @@ Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) {
//if the fontPath includes %SystemRoot%
LPWSTR systemRoot = _wgetenv(L"SystemRoot");
if (systemRoot != NULL
&& swprintf(tmpPath, L"%s%s", systemRoot, fontPath + 12) != -1) {
&& swprintf(tmpPath, MAX_PATH, L"%s%s", systemRoot, fontPath + 12) != -1) {
fontPath = tmpPath;
}
else {
......@@ -279,7 +279,7 @@ Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) {
//else to see if it only inludes "EUDC.TTE"
WCHAR systemRoot[MAX_PATH + 1];
if (GetWindowsDirectory(systemRoot, MAX_PATH + 1) != 0) {
swprintf(tmpPath, L"%s\\FONTS\\EUDC.TTE", systemRoot);
swprintf(tmpPath, MAX_PATH, L"%s\\FONTS\\EUDC.TTE", systemRoot);
fontPath = tmpPath;
}
else {
......
......@@ -219,7 +219,7 @@ AwtWindow::AwtWindow() {
::InitializeCriticalSection(&contentBitmapCS);
m_windowType = Type::NORMAL;
m_windowType = NORMAL;
m_alwaysOnTop = false;
}
......@@ -1016,9 +1016,9 @@ void AwtWindow::InitType(JNIEnv *env, jobject peer)
}
if (strcmp(valueNative, "UTILITY") == 0) {
m_windowType = Type::UTILITY;
m_windowType = UTILITY;
} else if (strcmp(valueNative, "POPUP") == 0) {
m_windowType = Type::POPUP;
m_windowType = POPUP;
}
env->ReleaseStringUTFChars(value, valueNative);
......@@ -1029,10 +1029,10 @@ void AwtWindow::InitType(JNIEnv *env, jobject peer)
void AwtWindow::TweakStyle(DWORD & style, DWORD & exStyle)
{
switch (GetType()) {
case Type::UTILITY:
case UTILITY:
exStyle |= WS_EX_TOOLWINDOW;
break;
case Type::POPUP:
case POPUP:
style &= ~WS_OVERLAPPED;
style |= WS_POPUP;
break;
......
/*
* Copyright (c) 2010, 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 6829546
@summary tests that an always-on-top modal dialog doesn't make any windows always-on-top
@author artem.ananiev: area=awt.modal
@library ../../regtesthelpers
@build Util
@run main MakeWindowAlwaysOnTop
*/
import java.awt.*;
import java.awt.event.*;
import test.java.awt.regtesthelpers.Util;
public class MakeWindowAlwaysOnTop
{
private static Frame f;
private static Dialog d;
public static void main(String[] args) throws Exception
{
Robot r = Util.createRobot();
Util.waitForIdle(r);
// Frame
f = new Frame("Test frame");
f.setBounds(100, 100, 400, 300);
f.setBackground(Color.RED);
f.setVisible(true);
r.delay(100);
Util.waitForIdle(r);
// Dialog
d = new Dialog(null, "Modal dialog", Dialog.ModalityType.APPLICATION_MODAL);
d.setBounds(500, 500, 160, 160);
d.setAlwaysOnTop(true);
EventQueue.invokeLater(new Runnable()
{
public void run()
{
d.setVisible(true);
}
});
// Wait until the dialog is shown
EventQueue.invokeAndWait(new Runnable()
{
public void run()
{
// Empty
}
});
r.delay(100);
Util.waitForIdle(r);
// Click on the frame to trigger modality
Point p = f.getLocationOnScreen();
r.mouseMove(p.x + f.getWidth() / 2, p.y + f.getHeight() / 2);
Util.waitForIdle(r);
r.mousePress(InputEvent.BUTTON1_MASK);
Util.waitForIdle(r);
r.mouseRelease(InputEvent.BUTTON1_MASK);
Util.waitForIdle(r);
r.delay(100);
Util.waitForIdle(r);
// Dispose dialog
d.dispose();
r.delay(100);
Util.waitForIdle(r);
// Show another frame at the same location
Frame t = new Frame("Check");
t.setBounds(100, 100, 400, 300);
t.setBackground(Color.BLUE);
t.setVisible(true);
r.delay(100);
Util.waitForIdle(r);
// Bring it above the first frame
t.toFront();
r.delay(100);
Util.waitForIdle(r);
Color c = r.getPixelColor(p.x + f.getWidth() / 2, p.y + f.getHeight() / 2);
System.out.println("Color = " + c);
System.out.flush();
// If the color is RED, then the first frame is now always-on-top
if (Color.RED.equals(c))
{
throw new RuntimeException("Test FAILED: the frame is always-on-top");
}
else if (!Color.BLUE.equals(c))
{
throw new RuntimeException("Test FAILED: unknown window is on top of the frame");
}
else
{
System.out.println("Test PASSED");
System.out.flush();
}
// Dispose all the windows
t.dispose();
f.dispose();
}
}
/*
* Copyright (c) 2010, 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 6895647
@summary X11 Frame locations should be what we set them to
@author anthony.petrov@oracle.com: area=awt.toplevel
@run main FrameLocation
*/
import java.awt.*;
public class FrameLocation {
private static final int X = 250;
private static final int Y = 250;
public static void main(String[] args) {
Frame f = new Frame("test");
f.setBounds(X, Y, 250, 250); // the size doesn't matter
f.setVisible(true);
for (int i = 0; i < 10; i++) {
// 2 seconds must be enough for the WM to show the window
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
}
// Check the location
int x = f.getX();
int y = f.getY();
if (x != X || y != Y) {
throw new RuntimeException("The frame location is wrong! Current: " + x + ", " + y + "; expected: " + X + ", " + Y);
}
// Emulate what happens when setGraphicsConfiguration() is called
synchronized (f.getTreeLock()) {
f.removeNotify();
f.addNotify();
}
}
f.dispose();
}
}
/*
* Copyright (c) 2010, 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.
*/
/*
@test
@bug 6838089
@summary Translucent windows should throw exception in FS mode
@author dmitry.cherepanov@oracle.com: area=awt-multiscreen
@run main TranslucencyThrowsExceptionWhenFullScreen
*/
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
public class TranslucencyThrowsExceptionWhenFullScreen
{
public static void main(String[] args)
throws InvocationTargetException, InterruptedException
{
EventQueue.invokeAndWait(
new Runnable(){
public void run() {
Frame frame = new Frame();
frame.setBounds(100,100,100,100);
frame.setVisible(true);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = ge.getScreenDevices();
for (GraphicsDevice device : devices) {
testGraphicsDevice(device, frame);
}
frame.dispose();
}
}
);
}
private static void testGraphicsDevice(GraphicsDevice device, Frame frame) {
device.setFullScreenWindow(frame);
try {
frame.setOpacity(0.5f);
throw new RuntimeException("Test fails, there's no exception for device="+device);
} catch(IllegalComponentStateException e) {
device.setFullScreenWindow(null);
}
}
}
/*
* Copyright (c) 2010, 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 6773022
* @summary Test verifies that SampleModel.getDataElements() throws an appropriate
* exception if coordinates are not in bounds.
*
* @run main GetDataElementsTest
*/
import java.awt.image.ComponentSampleModel;
import java.awt.image.DataBuffer;
import java.awt.image.SampleModel;
public class GetDataElementsTest {
public static int width = 100;
public static int height = 100;
public static int dataType = DataBuffer.TYPE_BYTE;
public static int numBands = 4;
public static void main(String[] args) {
SampleModel sm = new ComponentSampleModel(dataType, width, height, 4, width * 4, new int[] { 0, 1, 2, 3 } );
DataBuffer db = sm.createDataBuffer();
Object o = null;
boolean testPassed = false;
try {
o = sm.getDataElements(Integer.MAX_VALUE, 0, 1, 1, o, db);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println(e.getMessage());
testPassed = true;
}
if (!testPassed) {
throw new RuntimeException("Excpected excprion was not thrown.");
}
}
}
/*
* Copyright (c) 2010, 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 6970930
* @summary verify that compare() throws NPE instead of IAE when an argument is null.
*/
import java.text.*;
public class Bug6970930 {
private static boolean err = false;
public static void main(String[] args) {
// Check if compare() throws NPE.
test1(null, null);
test1("\"foo\"", null);
test1(null, "\"bar\"");
if (err) {
throw new RuntimeException("Failed.");
} else {
System.out.println("Passed.");
}
}
private static void test1(String s1, String s2) {
RuleBasedCollator col = null;
try {
col = new RuleBasedCollator("< a < b");
}
catch (ParseException e) {
err = true;
System.err.println(e);
}
try {
col.compare("foo", "bar"); // This line is necessary to reproduce the bug.
col.compare(s1, s2);
err = true;
System.err.println("No exception was thrown for compare(" +
s1 + ", " + s2 + ").");
}
catch (NullPointerException e) {
System.out.println("NPE was thrown as expected for compare(" +
s1 + ", " + s2 + ").");
}
catch (Exception e) {
err = true;
System.err.println("Unexpected exception was thrown for compare(" +
s1 + ", " + s2 + "): " + e);
}
}
}
/*
* Copyright (c) 2010, 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 6989440
* @summary Verify ConcurrentModificationException is not thrown with multiple
* thread accesses.
* @compile -XDignore.symbol.file=true Bug6989440.java
* @run main Bug6989440
*/
import java.text.spi.DateFormatProvider;
import java.util.spi.LocaleNameProvider;
import java.util.spi.LocaleServiceProvider;
import java.util.spi.TimeZoneNameProvider;
import sun.util.LocaleServiceProviderPool;
public class Bug6989440 {
public static void main(String[] args) {
TestThread t1 = new TestThread(LocaleNameProvider.class);
TestThread t2 = new TestThread(TimeZoneNameProvider.class);
TestThread t3 = new TestThread(DateFormatProvider.class);
t1.start();
t2.start();
t3.start();
}
static class TestThread extends Thread {
private Class<? extends LocaleServiceProvider> cls;
public TestThread(Class<? extends LocaleServiceProvider> providerClass) {
cls = providerClass;
}
public void run() {
LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(cls);
pool.getAvailableLocales();
}
}
}
......@@ -614,6 +614,55 @@ public class LocaleEnhanceTest extends LocaleTestFmwk {
assertEquals("hans DE", "Simplified Han", hansLocale.getDisplayScript(Locale.GERMANY));
}
public void testGetDisplayName() {
final Locale[] testLocales = {
Locale.ROOT,
new Locale("en"),
new Locale("en", "US"),
new Locale("", "US"),
new Locale("no", "NO", "NY"),
new Locale("", "", "NY"),
Locale.forLanguageTag("zh-Hans"),
Locale.forLanguageTag("zh-Hant"),
Locale.forLanguageTag("zh-Hans-CN"),
Locale.forLanguageTag("und-Hans"),
};
final String[] displayNameEnglish = {
"",
"English",
"English (United States)",
"United States",
"Norwegian (Norway,Nynorsk)",
"Nynorsk",
"Chinese (Simplified Han)",
"Chinese (Traditional Han)",
"Chinese (Simplified Han,China)",
"Simplified Han",
};
final String[] displayNameSimplifiedChinese = {
"",
"\u82f1\u6587",
"\u82f1\u6587 (\u7f8e\u56fd)",
"\u7f8e\u56fd",
"\u632a\u5a01\u6587 (\u632a\u5a01,Nynorsk)",
"Nynorsk",
"\u4e2d\u6587 (\u7b80\u4f53\u4e2d\u6587)",
"\u4e2d\u6587 (\u7e41\u4f53\u4e2d\u6587)",
"\u4e2d\u6587 (\u7b80\u4f53\u4e2d\u6587,\u4e2d\u56fd)",
"\u7b80\u4f53\u4e2d\u6587",
};
for (int i = 0; i < testLocales.length; i++) {
Locale loc = testLocales[i];
assertEquals("English display name for " + loc.toLanguageTag(),
displayNameEnglish[i], loc.getDisplayName(Locale.ENGLISH));
assertEquals("Simplified Chinese display name for " + loc.toLanguageTag(),
displayNameSimplifiedChinese[i], loc.getDisplayName(Locale.CHINA));
}
}
///
/// Builder tests
///
......
/*
* Copyright (c) 2010, 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 6986385
@summary JLayer should implement accessible interface
@author Alexander Potochkin
@run main bug6986385
*/
import javax.swing.*;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
public class bug6986385 {
public static void main(String... args) throws Exception {
JLayer l = new JLayer();
AccessibleContext acc = l.getAccessibleContext();
if (acc == null) {
throw new RuntimeException("JLayer's AccessibleContext is null");
}
if (acc.getAccessibleRole() != AccessibleRole.PANEL) {
throw new RuntimeException("JLayer's AccessibleRole must be PANEL");
}
}
}
......@@ -47,7 +47,7 @@ public class ToFloatArray {
for (int big = 0; big < 2; big+=1)
for (int bits = 32; bits <= 64; bits+=32) {
AudioFormat frm = new AudioFormat(
AudioFloatConverter.PCM_FLOAT,
AudioFormat.Encoding.PCM_FLOAT,
44100, bits, 1, bits/8,
44100, big==1);
byte[] buff = new byte[testarray.length * frm.getFrameSize()];
......
......@@ -84,16 +84,16 @@ public class DummySourceDataLine implements SourceDataLine {
AudioSystem.NOT_SPECIFIED, bits, channels, channels
* bits / 8, AudioSystem.NOT_SPECIFIED, true));
}
formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
formats.add(new AudioFormat(Encoding.PCM_FLOAT,
AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
AudioSystem.NOT_SPECIFIED, false));
formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
formats.add(new AudioFormat(Encoding.PCM_FLOAT,
AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
AudioSystem.NOT_SPECIFIED, true));
formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
formats.add(new AudioFormat(Encoding.PCM_FLOAT,
AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
AudioSystem.NOT_SPECIFIED, false));
formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
formats.add(new AudioFormat(Encoding.PCM_FLOAT,
AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
AudioSystem.NOT_SPECIFIED, true));
}
......
......@@ -84,16 +84,16 @@ public class DummySourceDataLine implements SourceDataLine {
AudioSystem.NOT_SPECIFIED, bits, channels, channels
* bits / 8, AudioSystem.NOT_SPECIFIED, true));
}
formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
formats.add(new AudioFormat(Encoding.PCM_FLOAT,
AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
AudioSystem.NOT_SPECIFIED, false));
formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
formats.add(new AudioFormat(Encoding.PCM_FLOAT,
AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
AudioSystem.NOT_SPECIFIED, true));
formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
formats.add(new AudioFormat(Encoding.PCM_FLOAT,
AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
AudioSystem.NOT_SPECIFIED, false));
formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
formats.add(new AudioFormat(Encoding.PCM_FLOAT,
AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
AudioSystem.NOT_SPECIFIED, true));
}
......
/*
* Copyright (c) 2010, 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 6396844
* @summary Tests memory leak for 20000 files
* @author Sergey Malenkov
* @run main/othervm/timeout=1000 -mx256m TwentyThousandTest
*/
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
public class TwentyThousandTest implements ActionListener, Runnable {
private static final int FILES = 20000;
private static final int ATTEMPTS = 100;
private static final int INTERVAL = 100;
private static final boolean ALWAYS_NEW_INSTANCE = false;
private static final boolean UPDATE_UI_EACH_INTERVAL = true;
private static final boolean AUTO_CLOSE_DIALOG = true;
private static JFileChooser CHOOSER;
private static String tmpDir;
public static void main(String[] args) throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
if (tmpDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
tmpDir = System.getProperty("user.home");
}
System.out.println("Temp directory: " + tmpDir);
System.out.println("Creating " + FILES + " files");
for (int i = 0; i < FILES; i++) {
File file = getTempFile(i);
FileWriter writer = new FileWriter(file);
writer.write("File " + i);
writer.close();
}
for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
if (laf.getClassName().contains("Motif")) {
continue;
}
UIManager.setLookAndFeel(laf.getClassName());
System.out.println("Do " + ATTEMPTS + " attempts for " + laf.getClassName());
for ( int i = 0; i < ATTEMPTS; i++ ) {
System.out.print(i + " ");
doAttempt();
}
System.out.println();
CHOOSER = null;
}
System.out.println("Removing " + FILES + " files");
for (int i = 0; i < FILES; i++) {
getTempFile(i).delete();
}
System.out.println( "Test passed successfully" );
}
private static File getTempFile(int i) {
return new File(tmpDir, "temp" + i + ".txt");
}
private static void doAttempt() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if ( ALWAYS_NEW_INSTANCE || ( CHOOSER == null ) )
CHOOSER = new JFileChooser(tmpDir);
if ( UPDATE_UI_EACH_INTERVAL )
CHOOSER.updateUI();
if ( AUTO_CLOSE_DIALOG ) {
Thread t = new Thread( new TwentyThousandTest( CHOOSER ) );
t.start();
CHOOSER.showOpenDialog( null );
} else {
CHOOSER.showOpenDialog( null );
}
}
});
// Allow to collect garbage by GC
Thread.sleep(1000);
System.gc();
}
private final JFileChooser chooser;
TwentyThousandTest( JFileChooser chooser ) {
this.chooser = chooser;
}
public void run() {
while ( !this.chooser.isShowing() ) {
try {
Thread.sleep( 30 );
} catch ( InterruptedException exception ) {
exception.printStackTrace();
}
}
Timer timer = new Timer( INTERVAL, this );
timer.setRepeats( false );
timer.start();
}
public void actionPerformed( ActionEvent event ) {
this.chooser.cancelSelection();
}
}
/*
* Copyright (c) 2010, 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 6984643
* @summary Unable to instantiate JFileChooser with a minimal BasicL&F descendant installed
* @author Pavel Porvatov
*/
import javax.swing.*;
import javax.swing.plaf.basic.BasicLookAndFeel;
public class Test6984643 {
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new BasicLookAndFeel() {
public String getName() {
return "A name";
}
public String getID() {
return "An id";
}
public String getDescription() {
return "A description";
}
public boolean isNativeLookAndFeel() {
return false;
}
public boolean isSupportedLookAndFeel() {
return true;
}
});
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new JFileChooser();
}
});
}
}
......@@ -59,7 +59,7 @@ public class TestShutdown
while (!appcontextInitDone)
{
Thread.sleep(500);
Thread.sleep(1000);
}
targetAppContext.dispose();
......@@ -146,7 +146,6 @@ public class TestShutdown
startGUI();
}
});
stk.realSync();
// start multiple SwingWorkers
while (!Thread.interrupted())
......
......@@ -104,7 +104,9 @@ public class DrawImageBilinear extends Canvas {
// second time will be a texture->surface blit
g2d.drawImage(bimg2, 80, 10, 40, 40, null);
g2d.drawImage(bimg2, 80, 10, 40, 40, null);
if (!skipOglTextureTest) {
g2d.drawImage(bimg2, 80, 10, 40, 40, null);
}
// third time will be a pbuffer->surface blit
if (vimg.validate(getGraphicsConfiguration()) != VolatileImage.IMAGE_OK) {
......@@ -150,6 +152,8 @@ public class DrawImageBilinear extends Canvas {
}
}
private static boolean skipOglTextureTest = false;
public static void main(String[] args) {
boolean show = false;
for (String arg : args) {
......@@ -158,6 +162,11 @@ public class DrawImageBilinear extends Canvas {
}
}
String arch = System.getProperty("os.arch");
boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl");
skipOglTextureTest = isOglEnabled && ("sparc".equals(arch));
System.out.println("Skip OpenGL texture test: " + skipOglTextureTest);
DrawImageBilinear test = new DrawImageBilinear();
Frame frame = new Frame();
frame.add(test);
......
......@@ -105,7 +105,7 @@ public class MutableColorTest {
for (int y = 0; y < snapshot.getHeight(); y++) {
for (int x = 0; x < snapshot.getWidth(); x++) {
int snapRGB = snapshot.getRGB(x, y);
if (snapRGB != evilColor) {
if (!isSameColor(snapRGB, evilColor)) {
System.err.printf("Wrong RGB for %s at (%d,%d): 0x%x " +
"instead of 0x%x\n", desc, x, y, snapRGB, evilColor);
String fileName = "MutableColorTest_"+desc+".png";
......@@ -166,4 +166,24 @@ public class MutableColorTest {
System.err.println("Test passed.");
}
/*
* We assume that colors with slightly different components
* are the same. This is done just in order to workaround
* peculiarities of OGL rendering pipeline on some platforms.
* See CR 6989217 for more details.
*/
private static boolean isSameColor(int color1, int color2) {
final int tolerance = 2;
for (int i = 0; i < 32; i += 8) {
int c1 = 0xff & (color1 >> i);
int c2 = 0xff & (color2 >> i);
if (Math.abs(c1 - c2) > tolerance) {
return false;
}
}
return true;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册