mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-08 04:29:28 +00:00
Merge
This commit is contained in:
commit
a33f306c8f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -41,15 +41,15 @@ import apple.laf.JRSUIUtils.NineSliceMetricsProvider;
|
||||
|
||||
abstract class AquaPainter <T extends JRSUIState> {
|
||||
static <T extends JRSUIState> AquaPainter<T> create(final T state) {
|
||||
return new AquaSingleImagePainter<T>(state);
|
||||
return new AquaSingleImagePainter<>(state);
|
||||
}
|
||||
|
||||
static <T extends JRSUIState> AquaPainter<T> create(final T state, final int minWidth, final int minHeight, final int westCut, final int eastCut, final int northCut, final int southCut) {
|
||||
return AquaPainter.create(state, minWidth, minHeight, westCut, eastCut, northCut, southCut, true);
|
||||
return create(state, minWidth, minHeight, westCut, eastCut, northCut, southCut, true);
|
||||
}
|
||||
|
||||
static <T extends JRSUIState> AquaPainter<T> create(final T state, final int minWidth, final int minHeight, final int westCut, final int eastCut, final int northCut, final int southCut, final boolean useMiddle) {
|
||||
return AquaPainter.create(state, minWidth, minHeight, westCut, eastCut, northCut, southCut, useMiddle, true, true);
|
||||
return create(state, minWidth, minHeight, westCut, eastCut, northCut, southCut, useMiddle, true, true);
|
||||
}
|
||||
|
||||
static <T extends JRSUIState> AquaPainter<T> create(final T state, final int minWidth, final int minHeight, final int westCut, final int eastCut, final int northCut, final int southCut, final boolean useMiddle, final boolean stretchHorizontally, final boolean stretchVertically) {
|
||||
@ -65,7 +65,7 @@ abstract class AquaPainter <T extends JRSUIState> {
|
||||
return new AquaNineSlicingImagePainter<>(state, metricsProvider);
|
||||
}
|
||||
|
||||
abstract void paint(final Graphics2D g, final T stateToPaint, final Component c);
|
||||
abstract void paint(Graphics2D g, T stateToPaint);
|
||||
|
||||
final Rectangle boundsRect = new Rectangle();
|
||||
final JRSUIControl control;
|
||||
@ -75,23 +75,26 @@ abstract class AquaPainter <T extends JRSUIState> {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
JRSUIControl getControl() {
|
||||
control.set(state = (T)state.derive());
|
||||
final JRSUIControl getControl() {
|
||||
control.set(state = state.derive());
|
||||
return control;
|
||||
}
|
||||
|
||||
void paint(final Graphics g, final Component c, final int x, final int y, final int w, final int h) {
|
||||
final void paint(final Graphics g, final Component c, final int x,
|
||||
final int y, final int w, final int h) {
|
||||
boundsRect.setBounds(x, y, w, h);
|
||||
|
||||
final T nextState = (T)state.derive();
|
||||
final T nextState = state.derive();
|
||||
final Graphics2D g2d = getGraphics2D(g);
|
||||
if (g2d != null) paint(g2d, nextState, c);
|
||||
if (g2d != null) paint(g2d, nextState);
|
||||
state = nextState;
|
||||
}
|
||||
|
||||
static class AquaNineSlicingImagePainter<T extends JRSUIState> extends AquaPainter<T> {
|
||||
protected final HashMap<T, RecyclableJRSUISlicedImageControl> slicedControlImages;
|
||||
protected final NineSliceMetricsProvider metricsProvider;
|
||||
private static class AquaNineSlicingImagePainter<T extends JRSUIState>
|
||||
extends AquaPainter<T> {
|
||||
|
||||
private final HashMap<T, RecyclableJRSUISlicedImageControl> slicedControlImages;
|
||||
private final NineSliceMetricsProvider metricsProvider;
|
||||
|
||||
AquaNineSlicingImagePainter(final T state) {
|
||||
this(state, null);
|
||||
@ -104,9 +107,9 @@ abstract class AquaPainter <T extends JRSUIState> {
|
||||
}
|
||||
|
||||
@Override
|
||||
void paint(final Graphics2D g, final T stateToPaint, final Component c) {
|
||||
void paint(final Graphics2D g, final T stateToPaint) {
|
||||
if (metricsProvider == null) {
|
||||
AquaSingleImagePainter.paintFromSingleCachedImage(g, control, stateToPaint, c, boundsRect);
|
||||
AquaSingleImagePainter.paintFromSingleCachedImage(g, control, stateToPaint, boundsRect);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -114,7 +117,7 @@ abstract class AquaPainter <T extends JRSUIState> {
|
||||
if (slicesRef == null) {
|
||||
final NineSliceMetrics metrics = metricsProvider.getNineSliceMetricsForState(stateToPaint);
|
||||
if (metrics == null) {
|
||||
AquaSingleImagePainter.paintFromSingleCachedImage(g, control, stateToPaint, c, boundsRect);
|
||||
AquaSingleImagePainter.paintFromSingleCachedImage(g, control, stateToPaint, boundsRect);
|
||||
return;
|
||||
}
|
||||
slicesRef = new RecyclableJRSUISlicedImageControl(control, stateToPaint, metrics);
|
||||
@ -125,47 +128,55 @@ abstract class AquaPainter <T extends JRSUIState> {
|
||||
}
|
||||
}
|
||||
|
||||
static class AquaSingleImagePainter<T extends JRSUIState> extends AquaPainter<T> {
|
||||
private static final class AquaSingleImagePainter<T extends JRSUIState>
|
||||
extends AquaPainter<T> {
|
||||
|
||||
AquaSingleImagePainter(final T state) {
|
||||
super(new JRSUIControl(false), state);
|
||||
}
|
||||
|
||||
@Override
|
||||
void paint(Graphics2D g, T stateToPaint, Component c) {
|
||||
paintFromSingleCachedImage(g, control, stateToPaint, c, boundsRect);
|
||||
void paint(final Graphics2D g, final T stateToPaint) {
|
||||
paintFromSingleCachedImage(g, control, stateToPaint, boundsRect);
|
||||
}
|
||||
|
||||
static void paintFromSingleCachedImage(final Graphics2D g, final JRSUIControl control, final JRSUIState controlState, final Component c, final Rectangle boundsRect) {
|
||||
final Rectangle clipRect = g.getClipBounds();
|
||||
final Rectangle intersection = boundsRect.intersection(clipRect);
|
||||
if (intersection.width <= 0 || intersection.height <= 0) return;
|
||||
|
||||
final int imgX1 = intersection.x - boundsRect.x;
|
||||
final int imgY1 = intersection.y - boundsRect.y;
|
||||
static void paintFromSingleCachedImage(final Graphics2D g,
|
||||
final JRSUIControl control, final JRSUIState controlState,
|
||||
final Rectangle bounds) {
|
||||
if (bounds.width <= 0 || bounds.height <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int scale = 1;
|
||||
if (g instanceof SunGraphics2D) {
|
||||
scale = ((SunGraphics2D) g).surfaceData.getDefaultScale();
|
||||
}
|
||||
final GraphicsConfiguration config = g.getDeviceConfiguration();
|
||||
final ImageCache cache = ImageCache.getInstance();
|
||||
BufferedImage image = (BufferedImage)cache.getImage(config, boundsRect.width, boundsRect.height, controlState);
|
||||
if (image == null) {
|
||||
image = new BufferedImage(boundsRect.width, boundsRect.height, BufferedImage.TYPE_INT_ARGB_PRE);
|
||||
cache.setImage(image, config, boundsRect.width, boundsRect.height, controlState);
|
||||
final WritableRaster raster = image.getRaster();
|
||||
final DataBufferInt buffer = (DataBufferInt)raster.getDataBuffer();
|
||||
final int imgW = bounds.width * scale;
|
||||
final int imgH = bounds.height * scale;
|
||||
BufferedImage img = (BufferedImage) cache.getImage(config, imgW, imgH, scale, controlState);
|
||||
if (img == null) {
|
||||
img = new BufferedImage(imgW, imgH, BufferedImage.TYPE_INT_ARGB_PRE);
|
||||
cache.setImage(img, config, imgW, imgH, scale, controlState);
|
||||
final WritableRaster raster = img.getRaster();
|
||||
final DataBufferInt buffer = (DataBufferInt) raster.getDataBuffer();
|
||||
|
||||
control.set(controlState);
|
||||
control.paint(SunWritableRaster.stealData(buffer, 0),
|
||||
image.getWidth(), image.getHeight(), 0, 0, boundsRect.width, boundsRect.height);
|
||||
imgW, imgH, 0, 0, bounds.width, bounds.height);
|
||||
SunWritableRaster.markDirty(buffer);
|
||||
}
|
||||
|
||||
g.drawImage(image, intersection.x, intersection.y, intersection.x + intersection.width, intersection.y + intersection.height,
|
||||
imgX1, imgY1, imgX1 + intersection.width, imgY1 + intersection.height, null);
|
||||
g.drawImage(img, bounds.x, bounds.y, bounds.width, bounds.height, null);
|
||||
}
|
||||
}
|
||||
|
||||
static class RecyclableJRSUISlicedImageControl extends RecyclableSlicedImageControl {
|
||||
final JRSUIControl control;
|
||||
final JRSUIState state;
|
||||
private static class RecyclableJRSUISlicedImageControl
|
||||
extends RecyclableSlicedImageControl {
|
||||
|
||||
private final JRSUIControl control;
|
||||
private final JRSUIState state;
|
||||
|
||||
RecyclableJRSUISlicedImageControl(final JRSUIControl control, final JRSUIState state, final NineSliceMetrics metrics) {
|
||||
super(metrics);
|
||||
@ -189,17 +200,19 @@ abstract class AquaPainter <T extends JRSUIState> {
|
||||
}
|
||||
}
|
||||
|
||||
protected Graphics2D getGraphics2D(final Graphics g) {
|
||||
private Graphics2D getGraphics2D(final Graphics g) {
|
||||
try {
|
||||
return (SunGraphics2D)g; // doing a blind try is faster than checking instanceof
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
if (g instanceof PeekGraphics) {
|
||||
// if it is a peek just dirty the region
|
||||
g.fillRect(boundsRect.x, boundsRect.y, boundsRect.width, boundsRect.height);
|
||||
} else if (g instanceof ProxyGraphics2D) {
|
||||
final ProxyGraphics2D pg = (ProxyGraphics2D)g;
|
||||
final Graphics2D g2d = pg.getDelegate();
|
||||
if (g2d instanceof SunGraphics2D) { return (SunGraphics2D)g2d; }
|
||||
if (g2d instanceof SunGraphics2D) {
|
||||
return g2d;
|
||||
}
|
||||
} else if (g instanceof Graphics2D) {
|
||||
return (Graphics2D) g;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -81,16 +81,23 @@ final class ImageCache {
|
||||
}
|
||||
}
|
||||
|
||||
public Image getImage(final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) {
|
||||
public Image getImage(final GraphicsConfiguration config, final int w,
|
||||
final int h, final int scale,
|
||||
final JRSUIState state) {
|
||||
final int hash = hash(config, w, h, scale, state);
|
||||
final PixelCountSoftReference ref;
|
||||
lock.readLock().lock();
|
||||
try {
|
||||
final PixelCountSoftReference ref = map.get(hash(config, w, h, state));
|
||||
// check reference has not been lost and the key truly matches, in case of false positive hash match
|
||||
if (ref != null && ref.equals(config, w, h, state)) return ref.get();
|
||||
return null;
|
||||
ref = map.get(hash);
|
||||
} finally {
|
||||
lock.readLock().unlock();
|
||||
}
|
||||
// check reference has not been lost and the key truly matches,
|
||||
// in case of false positive hash match
|
||||
if (ref != null && ref.equals(config, w, h, scale, state)) {
|
||||
return ref.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,14 +107,17 @@ final class ImageCache {
|
||||
* @param config The graphics configuration, needed if cached image is a Volatile Image. Used as part of cache key
|
||||
* @param w The image width, used as part of cache key
|
||||
* @param h The image height, used as part of cache key
|
||||
* @param scale The image scale factor, used as part of cache key
|
||||
* @return true if the image could be cached, false otherwise.
|
||||
*/
|
||||
public boolean setImage(final Image image, final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) {
|
||||
public boolean setImage(final Image image,
|
||||
final GraphicsConfiguration config, final int w, final int h,
|
||||
final int scale, final JRSUIState state) {
|
||||
if (state.is(JRSUIConstants.Animating.YES)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final int hash = hash(config, w, h, state);
|
||||
final int hash = hash(config, w, h, scale, state);
|
||||
|
||||
lock.writeLock().lock();
|
||||
try {
|
||||
@ -145,44 +155,60 @@ final class ImageCache {
|
||||
}
|
||||
}
|
||||
// finally put new in map
|
||||
map.put(hash, new PixelCountSoftReference(image, referenceQueue, newPixelCount, hash, config, w, h, state));
|
||||
map.put(hash, new PixelCountSoftReference(image, referenceQueue, newPixelCount, hash, config, w, h, scale, state));
|
||||
return true;
|
||||
} finally {
|
||||
lock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private int hash(final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) {
|
||||
int hash = (config != null ? config.hashCode() : 0);
|
||||
private static int hash(final GraphicsConfiguration config, final int w,
|
||||
final int h, final int scale,
|
||||
final JRSUIState state) {
|
||||
int hash = config != null ? config.hashCode() : 0;
|
||||
hash = 31 * hash + w;
|
||||
hash = 31 * hash + h;
|
||||
hash = 31 * hash + scale;
|
||||
hash = 31 * hash + state.hashCode();
|
||||
return hash;
|
||||
}
|
||||
|
||||
/** Extended SoftReference that stores the pixel count even after the image is lost */
|
||||
/**
|
||||
* Extended SoftReference that stores the pixel count even after the image
|
||||
* is lost.
|
||||
*/
|
||||
private static class PixelCountSoftReference extends SoftReference<Image> {
|
||||
private final int pixelCount;
|
||||
private final int hash;
|
||||
|
||||
// default access, because access to these fields shouldn't be emulated
|
||||
// by a synthetic accessor.
|
||||
final int pixelCount;
|
||||
final int hash;
|
||||
|
||||
// key parts
|
||||
private final GraphicsConfiguration config;
|
||||
private final int w;
|
||||
private final int h;
|
||||
private final int scale;
|
||||
private final JRSUIState state;
|
||||
|
||||
PixelCountSoftReference(final Image referent, final ReferenceQueue<? super Image> q, final int pixelCount, final int hash, final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) {
|
||||
PixelCountSoftReference(final Image referent,
|
||||
final ReferenceQueue<? super Image> q, final int pixelCount,
|
||||
final int hash, final GraphicsConfiguration config, final int w,
|
||||
final int h, final int scale, final JRSUIState state) {
|
||||
super(referent, q);
|
||||
this.pixelCount = pixelCount;
|
||||
this.hash = hash;
|
||||
this.config = config;
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
this.scale = scale;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public boolean equals(final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) {
|
||||
return config == this.config && w == this.w && h == this.h && state.equals(this.state);
|
||||
boolean equals(final GraphicsConfiguration config, final int w,
|
||||
final int h, final int scale, final JRSUIState state) {
|
||||
return config == this.config && w == this.w && h == this.h
|
||||
&& scale == this.scale && state.equals(this.state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -219,6 +219,12 @@ public final class CGraphicsDevice extends GraphicsDevice {
|
||||
return nativeGetDisplayModes(displayID);
|
||||
}
|
||||
|
||||
public int getScaleFactor() {
|
||||
return (int) nativeGetScaleFactor(displayID);
|
||||
}
|
||||
|
||||
private static native double nativeGetScaleFactor(int displayID);
|
||||
|
||||
private static native void nativeSetDisplayMode(int displayID, int w, int h, int bpp, int refrate);
|
||||
|
||||
private static native DisplayMode nativeGetDisplayMode(int displayID);
|
||||
|
||||
@ -441,29 +441,37 @@ public final class CGLGraphicsConfig extends CGraphicsConfig
|
||||
|
||||
@Override
|
||||
public int getMaxTextureWidth() {
|
||||
int width;
|
||||
//Temporary disable this logic and use some magic constrain.
|
||||
/*
|
||||
int width;
|
||||
|
||||
synchronized (totalDisplayBounds) {
|
||||
if (totalDisplayBounds.width == 0) {
|
||||
updateTotalDisplayBounds();
|
||||
}
|
||||
width = totalDisplayBounds.width;
|
||||
}
|
||||
synchronized (totalDisplayBounds) {
|
||||
if (totalDisplayBounds.width == 0) {
|
||||
updateTotalDisplayBounds();
|
||||
}
|
||||
width = totalDisplayBounds.width;
|
||||
}
|
||||
|
||||
return Math.min(width, getMaxTextureSize());
|
||||
return Math.min(width, getMaxTextureSize());
|
||||
*/
|
||||
return getMaxTextureSize() / (getDevice().getScaleFactor() * 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTextureHeight() {
|
||||
int height;
|
||||
//Temporary disable this logic and use some magic constrain.
|
||||
/*
|
||||
int height;
|
||||
|
||||
synchronized (totalDisplayBounds) {
|
||||
if (totalDisplayBounds.height == 0) {
|
||||
updateTotalDisplayBounds();
|
||||
}
|
||||
height = totalDisplayBounds.height;
|
||||
}
|
||||
synchronized (totalDisplayBounds) {
|
||||
if (totalDisplayBounds.height == 0) {
|
||||
updateTotalDisplayBounds();
|
||||
}
|
||||
height = totalDisplayBounds.height;
|
||||
}
|
||||
|
||||
return Math.min(height, getMaxTextureSize());
|
||||
return Math.min(height, getMaxTextureSize());
|
||||
*/
|
||||
return getMaxTextureSize() / (getDevice().getScaleFactor() * 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,11 +40,12 @@ import java.awt.Transparency;
|
||||
public class CGLLayer extends CFRetainedResource {
|
||||
|
||||
private native long nativeCreateLayer();
|
||||
|
||||
private static native void nativeSetScale(long layerPtr, double scale);
|
||||
private static native void validate(long layerPtr, CGLSurfaceData cglsd);
|
||||
private static native void blitTexture(long layerPtr);
|
||||
|
||||
private LWWindowPeer peer;
|
||||
private int scale = 1;
|
||||
|
||||
private SurfaceData surfaceData; // represents intermediate buffer (texture)
|
||||
|
||||
@ -90,7 +91,7 @@ public class CGLLayer extends CFRetainedResource {
|
||||
// and blits the buffer to the layer surface (in drawInCGLContext callback)
|
||||
CGraphicsConfig gc = (CGraphicsConfig)peer.getGraphicsConfiguration();
|
||||
surfaceData = gc.createSurfaceData(this);
|
||||
|
||||
setScale(gc.getDevice().getScaleFactor());
|
||||
// the layer holds a reference to the buffer, which in
|
||||
// turn has a reference back to this layer
|
||||
if (surfaceData instanceof CGLSurfaceData) {
|
||||
@ -121,6 +122,13 @@ public class CGLLayer extends CFRetainedResource {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
private void setScale(final int _scale) {
|
||||
if (scale != _scale) {
|
||||
scale = _scale;
|
||||
nativeSetScale(getPointer(), scale);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// NATIVE CALLBACKS
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@ -30,7 +30,6 @@ import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Image;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.ColorModel;
|
||||
|
||||
@ -41,6 +40,9 @@ import sun.lwawt.macosx.CPlatformView;
|
||||
|
||||
public abstract class CGLSurfaceData extends OGLSurfaceData {
|
||||
|
||||
protected final int scale;
|
||||
protected final int width;
|
||||
protected final int height;
|
||||
protected CPlatformView pView;
|
||||
private CGLGraphicsConfig graphicsConfig;
|
||||
|
||||
@ -52,10 +54,19 @@ public abstract class CGLSurfaceData extends OGLSurfaceData {
|
||||
protected native boolean initPbuffer(long pData, long pConfigInfo,
|
||||
boolean isOpaque, int width, int height);
|
||||
|
||||
protected CGLSurfaceData(CPlatformView pView, CGLGraphicsConfig gc,
|
||||
ColorModel cm, int type)
|
||||
{
|
||||
protected CGLSurfaceData(CGLGraphicsConfig gc, ColorModel cm, int type,
|
||||
int width, int height) {
|
||||
super(gc, cm, type);
|
||||
// TEXTURE shouldn't be scaled, it is used for managed BufferedImages.
|
||||
scale = type == TEXTURE ? 1 : gc.getDevice().getScaleFactor();
|
||||
this.width = width * scale;
|
||||
this.height = height * scale;
|
||||
}
|
||||
|
||||
protected CGLSurfaceData(CPlatformView pView, CGLGraphicsConfig gc,
|
||||
ColorModel cm, int type,int width, int height)
|
||||
{
|
||||
this(gc, cm, type, width, height);
|
||||
this.pView = pView;
|
||||
this.graphicsConfig = gc;
|
||||
|
||||
@ -70,9 +81,9 @@ public abstract class CGLSurfaceData extends OGLSurfaceData {
|
||||
}
|
||||
|
||||
protected CGLSurfaceData(CGLLayer layer, CGLGraphicsConfig gc,
|
||||
ColorModel cm, int type)
|
||||
ColorModel cm, int type,int width, int height)
|
||||
{
|
||||
super(gc, cm, type);
|
||||
this(gc, cm, type, width, height);
|
||||
this.graphicsConfig = gc;
|
||||
|
||||
long pConfigInfo = gc.getNativeConfigInfo();
|
||||
@ -157,13 +168,43 @@ public abstract class CGLSurfaceData extends OGLSurfaceData {
|
||||
// Overridden in CGLWindowSurfaceData below
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultScale() {
|
||||
return scale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
|
||||
int dx, int dy) {
|
||||
final int state = sg2d.transformState;
|
||||
if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
|
||||
|| sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
|
||||
return false;
|
||||
}
|
||||
if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
|
||||
x += sg2d.transX;
|
||||
y += sg2d.transY;
|
||||
} else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
|
||||
final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
|
||||
sg2d.transform.transform(coords, 0, coords, 0, 3);
|
||||
x = (int) Math.ceil(coords[0] - 0.5);
|
||||
y = (int) Math.ceil(coords[1] - 0.5);
|
||||
w = ((int) Math.ceil(coords[2] - 0.5)) - x;
|
||||
h = ((int) Math.ceil(coords[3] - 0.5)) - y;
|
||||
dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
|
||||
dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
|
||||
}
|
||||
oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected native void clearWindow();
|
||||
|
||||
public static class CGLWindowSurfaceData extends CGLSurfaceData {
|
||||
|
||||
public CGLWindowSurfaceData(CPlatformView pView,
|
||||
CGLGraphicsConfig gc) {
|
||||
super(pView, gc, gc.getColorModel(), WINDOW);
|
||||
super(pView, gc, gc.getColorModel(), WINDOW, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -217,17 +258,12 @@ public abstract class CGLSurfaceData extends OGLSurfaceData {
|
||||
public static class CGLLayerSurfaceData extends CGLSurfaceData {
|
||||
|
||||
private CGLLayer layer;
|
||||
private int width, height;
|
||||
|
||||
public CGLLayerSurfaceData(CGLLayer layer, CGLGraphicsConfig gc,
|
||||
int width, int height) {
|
||||
super(layer, gc, gc.getColorModel(), FBOBJECT);
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
super(layer, gc, gc.getColorModel(), FBOBJECT, width, height);
|
||||
this.layer = layer;
|
||||
|
||||
initSurface(width, height);
|
||||
initSurface(this.width, this.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -296,18 +332,13 @@ public abstract class CGLSurfaceData extends OGLSurfaceData {
|
||||
|
||||
public static class CGLOffScreenSurfaceData extends CGLSurfaceData {
|
||||
private Image offscreenImage;
|
||||
private int width, height;
|
||||
|
||||
public CGLOffScreenSurfaceData(CPlatformView pView,
|
||||
CGLGraphicsConfig gc, int width, int height, Image image,
|
||||
ColorModel cm, int type) {
|
||||
super(pView, gc, cm, type);
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
super(pView, gc, cm, type, width, height);
|
||||
offscreenImage = image;
|
||||
|
||||
initSurface(width, height);
|
||||
initSurface(this.width, this.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -463,35 +463,8 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
|
||||
private void applyConstrain(final Graphics g) {
|
||||
final SunGraphics2D sg2d = (SunGraphics2D) g;
|
||||
final Rectangle constr = localToWindow(getSize());
|
||||
// translate and set rectangle constrain.
|
||||
sg2d.constrain(constr.x, constr.y, constr.width, constr.height);
|
||||
// set region constrain.
|
||||
//sg2d.constrain(getVisibleRegion());
|
||||
SG2DConstraint(sg2d, getVisibleRegion());
|
||||
}
|
||||
|
||||
//TODO Move this method to SG2D?
|
||||
void SG2DConstraint(final SunGraphics2D sg2d, Region r) {
|
||||
sg2d.constrainX = sg2d.transX;
|
||||
sg2d.constrainY = sg2d.transY;
|
||||
|
||||
Region c = sg2d.constrainClip;
|
||||
if ((sg2d.constrainX | sg2d.constrainY) != 0) {
|
||||
r = r.getTranslatedRegion(sg2d.constrainX, sg2d.constrainY);
|
||||
}
|
||||
if (c == null) {
|
||||
c = r;
|
||||
} else {
|
||||
c = c.getIntersection(r);
|
||||
if (c == sg2d.constrainClip) {
|
||||
// Common case to ignore
|
||||
return;
|
||||
}
|
||||
}
|
||||
sg2d.constrainClip = c;
|
||||
//validateCompClip() forced call.
|
||||
sg2d.setDevClip(r.getLoX(), r.getLoY(), r.getWidth(), r.getHeight());
|
||||
final Rectangle size = localToWindow(getSize());
|
||||
sg2d.constrain(size.x, size.y, size.width, size.height, getVisibleRegion());
|
||||
}
|
||||
|
||||
public Region getVisibleRegion() {
|
||||
|
||||
@ -580,17 +580,16 @@ public class LWWindowPeer
|
||||
setBounds(x, y, w, h, SET_BOUNDS, false, false);
|
||||
|
||||
// Second, update the graphics config and surface data
|
||||
checkIfOnNewScreen();
|
||||
if (resized) {
|
||||
final boolean isNewDevice = updateGraphicsDevice();
|
||||
if (resized || isNewDevice) {
|
||||
replaceSurfaceData();
|
||||
flushOnscreenGraphics();
|
||||
}
|
||||
|
||||
// Third, COMPONENT_MOVED/COMPONENT_RESIZED/PAINT events
|
||||
if (moved || invalid) {
|
||||
handleMove(x, y, true);
|
||||
}
|
||||
if (resized || invalid) {
|
||||
if (resized || invalid || isNewDevice) {
|
||||
handleResize(w, h, true);
|
||||
repaintPeer();
|
||||
}
|
||||
@ -610,7 +609,7 @@ public class LWWindowPeer
|
||||
}
|
||||
if (!isTextured()) {
|
||||
if (g instanceof SunGraphics2D) {
|
||||
SG2DConstraint((SunGraphics2D) g, getRegion());
|
||||
((SunGraphics2D) g).constrain(0, 0, w, h, getRegion());
|
||||
}
|
||||
g.setColor(getBackground());
|
||||
g.fillRect(0, 0, w, h);
|
||||
@ -922,7 +921,7 @@ public class LWWindowPeer
|
||||
}
|
||||
// If window's graphics config is changed from the app code, the
|
||||
// config correspond to the same device as before; when the window
|
||||
// is moved by user, graphicsDevice is updated in checkIfOnNewScreen().
|
||||
// is moved by user, graphicsDevice is updated in notifyReshape().
|
||||
// In either case, there's nothing to do with screenOn here
|
||||
graphicsConfig = gc;
|
||||
}
|
||||
@ -930,11 +929,14 @@ public class LWWindowPeer
|
||||
return true;
|
||||
}
|
||||
|
||||
private void checkIfOnNewScreen() {
|
||||
/**
|
||||
* Returns true if the GraphicsDevice has been changed, false otherwise.
|
||||
*/
|
||||
public boolean updateGraphicsDevice() {
|
||||
GraphicsDevice newGraphicsDevice = platformWindow.getGraphicsDevice();
|
||||
synchronized (getStateLock()) {
|
||||
if (graphicsDevice == newGraphicsDevice) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
graphicsDevice = newGraphicsDevice;
|
||||
}
|
||||
@ -942,13 +944,14 @@ public class LWWindowPeer
|
||||
// TODO: DisplayChangedListener stuff
|
||||
final GraphicsConfiguration newGC = newGraphicsDevice.getDefaultConfiguration();
|
||||
|
||||
if (!setGraphicsConfig(newGC)) return;
|
||||
if (!setGraphicsConfig(newGC)) return false;
|
||||
|
||||
SunToolkit.executeOnEventHandlerThread(getTarget(), new Runnable() {
|
||||
public void run() {
|
||||
AWTAccessor.getComponentAccessor().setGraphicsConfiguration(getTarget(), newGC);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -983,6 +986,7 @@ public class LWWindowPeer
|
||||
oldData.flush();
|
||||
}
|
||||
}
|
||||
flushOnscreenGraphics();
|
||||
}
|
||||
|
||||
private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
|
||||
@ -990,14 +994,15 @@ public class LWWindowPeer
|
||||
if (src != dst && src != null && dst != null
|
||||
&& !(dst instanceof NullSurfaceData)
|
||||
&& !(src instanceof NullSurfaceData)
|
||||
&& src.getSurfaceType().equals(dst.getSurfaceType())) {
|
||||
final Rectangle size = getSize();
|
||||
&& src.getSurfaceType().equals(dst.getSurfaceType())
|
||||
&& src.getDefaultScale() == dst.getDefaultScale()) {
|
||||
final Rectangle size = src.getBounds();
|
||||
final Blit blit = Blit.locate(src.getSurfaceType(),
|
||||
CompositeType.Src,
|
||||
dst.getSurfaceType());
|
||||
if (blit != null) {
|
||||
blit.Blit(src, dst, AlphaComposite.Src,
|
||||
getRegion(), 0, 0, 0, 0, size.width, size.height);
|
||||
blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0,
|
||||
size.width, size.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1152,7 +1157,9 @@ public class LWWindowPeer
|
||||
if (!becomesFocused &&
|
||||
(isGrabbing() || getOwnerFrameDialog(grabbingWindow) == this))
|
||||
{
|
||||
focusLog.fine("ungrabbing on " + grabbingWindow);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("ungrabbing on " + grabbingWindow);
|
||||
}
|
||||
// ungrab a simple window if its owner looses activation.
|
||||
grabbingWindow.ungrab();
|
||||
}
|
||||
|
||||
@ -97,13 +97,7 @@ public class CEmbeddedFrame extends EmbeddedFrame {
|
||||
public void handleKeyEvent(int eventType, int modifierFlags, String characters,
|
||||
String charsIgnoringMods, boolean isRepeat, short keyCode,
|
||||
boolean needsKeyTyped) {
|
||||
responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode, needsKeyTyped);
|
||||
}
|
||||
|
||||
// REMIND: delete this method once 'deploy' changes for 7156194 is pushed
|
||||
public void handleKeyEvent(int eventType, int modifierFlags, String characters,
|
||||
String charsIgnoringMods, boolean isRepeat, short keyCode) {
|
||||
handleKeyEvent(eventType, modifierFlags, characters, charsIgnoringMods, isRepeat, keyCode, true);
|
||||
responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode, needsKeyTyped, isRepeat);
|
||||
}
|
||||
|
||||
public void handleInputEvent(String text) {
|
||||
|
||||
@ -41,6 +41,7 @@ final class CPlatformResponder {
|
||||
|
||||
private final LWWindowPeer peer;
|
||||
private final boolean isNpapiCallback;
|
||||
private int lastKeyPressCode = KeyEvent.VK_UNDEFINED;
|
||||
|
||||
CPlatformResponder(final LWWindowPeer peer, final boolean isNpapiCallback) {
|
||||
this.peer = peer;
|
||||
@ -123,7 +124,7 @@ final class CPlatformResponder {
|
||||
* Handles key events.
|
||||
*/
|
||||
void handleKeyEvent(int eventType, int modifierFlags, String chars,
|
||||
short keyCode, boolean needsKeyTyped) {
|
||||
short keyCode, boolean needsKeyTyped, boolean needsKeyReleased) {
|
||||
boolean isFlagsChangedEvent =
|
||||
isNpapiCallback ? (eventType == CocoaConstants.NPCocoaEventFlagsChanged) :
|
||||
(eventType == CocoaConstants.NSFlagsChanged);
|
||||
@ -183,6 +184,9 @@ final class CPlatformResponder {
|
||||
int jmodifiers = NSEvent.nsToJavaKeyModifiers(modifierFlags);
|
||||
long when = System.currentTimeMillis();
|
||||
|
||||
if (jeventType == KeyEvent.KEY_PRESSED) {
|
||||
lastKeyPressCode = jkeyCode;
|
||||
}
|
||||
peer.dispatchKeyEvent(jeventType, when, jmodifiers,
|
||||
jkeyCode, javaChar, jkeyLocation);
|
||||
|
||||
@ -195,26 +199,41 @@ final class CPlatformResponder {
|
||||
// Modifier keys (shift, etc) don't want to send TYPED events.
|
||||
// On the other hand we don't want to generate keyTyped events
|
||||
// for clipboard related shortcuts like Meta + [CVX]
|
||||
boolean isMetaDown = (jmodifiers & KeyEvent.META_DOWN_MASK) != 0;
|
||||
if (jeventType == KeyEvent.KEY_PRESSED && postsTyped && !isMetaDown) {
|
||||
if (jeventType == KeyEvent.KEY_PRESSED && postsTyped &&
|
||||
(jmodifiers & KeyEvent.META_DOWN_MASK) == 0) {
|
||||
// Enter and Space keys finish the input method processing,
|
||||
// KEY_TYPED and KEY_RELEASED events for them are synthesized in handleInputEvent.
|
||||
if (needsKeyReleased && (jkeyCode == KeyEvent.VK_ENTER || jkeyCode == KeyEvent.VK_SPACE)) {
|
||||
return;
|
||||
}
|
||||
peer.dispatchKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers,
|
||||
KeyEvent.VK_UNDEFINED, javaChar,
|
||||
KeyEvent.KEY_LOCATION_UNKNOWN);
|
||||
//If events come from Firefox, released events should also be generated.
|
||||
if (needsKeyReleased) {
|
||||
peer.dispatchKeyEvent(KeyEvent.KEY_RELEASED, when, jmodifiers,
|
||||
jkeyCode, javaChar,
|
||||
KeyEvent.KEY_LOCATION_UNKNOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handleInputEvent(String text) {
|
||||
if (text != null) {
|
||||
int index = 0, length = text.length();
|
||||
char c;
|
||||
char c = 0;
|
||||
while (index < length) {
|
||||
c = text.charAt(index);
|
||||
peer.dispatchKeyEvent(KeyEvent.KEY_TYPED,
|
||||
System.currentTimeMillis(),
|
||||
0, KeyEvent.VK_UNDEFINED, c,
|
||||
KeyEvent.KEY_LOCATION_UNKNOWN);
|
||||
System.currentTimeMillis(),
|
||||
0, KeyEvent.VK_UNDEFINED, c,
|
||||
KeyEvent.KEY_LOCATION_UNKNOWN);
|
||||
index++;
|
||||
}
|
||||
peer.dispatchKeyEvent(KeyEvent.KEY_RELEASED,
|
||||
System.currentTimeMillis(),
|
||||
0, lastKeyPressCode, c,
|
||||
KeyEvent.KEY_LOCATION_UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -202,7 +202,7 @@ public class CPlatformView extends CFRetainedResource {
|
||||
|
||||
private void deliverKeyEvent(NSEvent event) {
|
||||
responder.handleKeyEvent(event.getType(), event.getModifierFlags(),
|
||||
event.getCharactersIgnoringModifiers(), event.getKeyCode(), true);
|
||||
event.getCharactersIgnoringModifiers(), event.getKeyCode(), true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -860,8 +860,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
}
|
||||
}
|
||||
|
||||
private void flushBuffers() {
|
||||
if (isVisible() && !nativeBounds.isEmpty()) {
|
||||
void flushBuffers() {
|
||||
if (isVisible() && !nativeBounds.isEmpty() && !isFullScreenMode) {
|
||||
try {
|
||||
LWCToolkit.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -199,6 +199,7 @@ static inline jint doPaintImage
|
||||
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
|
||||
CGContextRef cgRef = CGBitmapContextCreate(rawPixelData, imgW, imgH, 8, imgW * 4, colorspace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
|
||||
CGColorSpaceRelease(colorspace);
|
||||
CGContextScaleCTM(cgRef, imgW/w , imgH/h);
|
||||
|
||||
jint status = doPaintCGContext(cgRef, controlPtr, oldProperties, newProperties, x, y, w, h);
|
||||
CGContextRelease(cgRef);
|
||||
|
||||
@ -315,3 +315,34 @@ Java_sun_awt_CGraphicsDevice_nativeGetDisplayModes
|
||||
|
||||
return jreturnArray;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_CGraphicsDevice
|
||||
* Method: nativeGetScaleFactor
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_sun_awt_CGraphicsDevice_nativeGetScaleFactor
|
||||
(JNIEnv *env, jclass class, jint displayID)
|
||||
{
|
||||
__block jdouble ret = 1.0f;
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
|
||||
NSArray *screens = [NSScreen screens];
|
||||
for (NSScreen *screen in screens) {
|
||||
NSDictionary *screenInfo = [screen deviceDescription];
|
||||
NSNumber *screenID = [screenInfo objectForKey:@"NSScreenNumber"];
|
||||
if ([screenID pointerValue] == displayID){
|
||||
if ([screen respondsToSelector:@selector(backingScaleFactor)]) {
|
||||
ret = [screen backingScaleFactor];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -61,6 +61,19 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
//Layer backed view
|
||||
//self.needsDisplayOnBoundsChange = YES;
|
||||
//self.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
|
||||
|
||||
//Disable CALayer's default animation
|
||||
NSMutableDictionary * actions = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSNull null], @"bounds",
|
||||
[NSNull null], @"contents",
|
||||
[NSNull null], @"contentsScale",
|
||||
[NSNull null], @"onOrderIn",
|
||||
[NSNull null], @"onOrderOut",
|
||||
[NSNull null], @"sublayers",
|
||||
nil];
|
||||
self.actions = actions;
|
||||
[actions release];
|
||||
|
||||
textureID = 0; // texture will be created by rendering pipe
|
||||
target = 0;
|
||||
|
||||
@ -121,8 +134,12 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
// Set the current context to the one given to us.
|
||||
CGLSetCurrentContext(glContext);
|
||||
|
||||
glViewport(0, 0, textureWidth, textureHeight);
|
||||
// Should clear the whole CALayer, because it can be larger than our texture.
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glViewport(0, 0, textureWidth, textureHeight);
|
||||
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
static JNF_CLASS_CACHE(jc_JavaLayer, "sun/java2d/opengl/CGLLayer");
|
||||
static JNF_MEMBER_CACHE(jm_drawInCGLContext, jc_JavaLayer, "drawInCGLContext", "()V");
|
||||
@ -168,7 +185,7 @@ JNF_COCOA_EXIT(env);
|
||||
// Must be called under the RQ lock.
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_opengl_CGLLayer_validate
|
||||
(JNIEnv *env, jobject obj, jlong layerPtr, jobject surfaceData)
|
||||
(JNIEnv *env, jclass cls, jlong layerPtr, jobject surfaceData)
|
||||
{
|
||||
CGLLayer *layer = OBJC(layerPtr);
|
||||
|
||||
@ -186,9 +203,21 @@ Java_sun_java2d_opengl_CGLLayer_validate
|
||||
// Must be called on the AppKit thread and under the RQ lock.
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_opengl_CGLLayer_blitTexture
|
||||
(JNIEnv *env, jobject obj, jlong layerPtr)
|
||||
(JNIEnv *env, jclass cls, jlong layerPtr)
|
||||
{
|
||||
CGLLayer *layer = jlong_to_ptr(layerPtr);
|
||||
|
||||
[layer blitTexture];
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_opengl_CGLLayer_nativeSetScale
|
||||
(JNIEnv *env, jclass cls, jlong layerPtr, jdouble scale)
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
CGLLayer *layer = jlong_to_ptr(layerPtr);
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
layer.contentsScale = scale;
|
||||
}];
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
@ -208,7 +208,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
|
||||
* aComponent is null
|
||||
*/
|
||||
public Component getComponentAfter(Container aContainer, Component aComponent) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Searching in " + aContainer + " for component after " + aComponent);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Searching in " + aContainer + " for component after " + aComponent);
|
||||
}
|
||||
|
||||
if (aContainer == null || aComponent == null) {
|
||||
throw new IllegalArgumentException("aContainer and aComponent cannot be null");
|
||||
@ -247,7 +249,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
|
||||
// Null result means that we overstepped the limit of the FTP's cycle.
|
||||
// In that case we must quit the cycle, otherwise return the component found.
|
||||
if (afterComp != null) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### FTP returned " + afterComp);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### FTP returned " + afterComp);
|
||||
}
|
||||
return afterComp;
|
||||
}
|
||||
aComponent = provider;
|
||||
@ -255,7 +259,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
|
||||
|
||||
List<Component> cycle = getFocusTraversalCycle(aContainer);
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is " + cycle + ", component is " + aComponent);
|
||||
}
|
||||
|
||||
int index = getComponentIndex(cycle, aComponent);
|
||||
|
||||
@ -336,7 +342,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
|
||||
// Null result means that we overstepped the limit of the FTP's cycle.
|
||||
// In that case we must quit the cycle, otherwise return the component found.
|
||||
if (beforeComp != null) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### FTP returned " + beforeComp);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### FTP returned " + beforeComp);
|
||||
}
|
||||
return beforeComp;
|
||||
}
|
||||
aComponent = provider;
|
||||
@ -349,7 +357,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
|
||||
|
||||
List<Component> cycle = getFocusTraversalCycle(aContainer);
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is " + cycle + ", component is " + aComponent);
|
||||
}
|
||||
|
||||
int index = getComponentIndex(cycle, aComponent);
|
||||
|
||||
@ -401,7 +411,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
|
||||
public Component getFirstComponent(Container aContainer) {
|
||||
List<Component> cycle;
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Getting first component in " + aContainer);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Getting first component in " + aContainer);
|
||||
}
|
||||
if (aContainer == null) {
|
||||
throw new IllegalArgumentException("aContainer cannot be null");
|
||||
|
||||
@ -420,10 +432,14 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
|
||||
}
|
||||
|
||||
if (cycle.size() == 0) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is empty");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is empty");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is " + cycle);
|
||||
}
|
||||
|
||||
for (Component comp : cycle) {
|
||||
if (accept(comp)) {
|
||||
@ -451,7 +467,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
|
||||
*/
|
||||
public Component getLastComponent(Container aContainer) {
|
||||
List<Component> cycle;
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Getting last component in " + aContainer);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Getting last component in " + aContainer);
|
||||
}
|
||||
|
||||
if (aContainer == null) {
|
||||
throw new IllegalArgumentException("aContainer cannot be null");
|
||||
@ -470,10 +488,14 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
|
||||
}
|
||||
|
||||
if (cycle.size() == 0) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is empty");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is empty");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is " + cycle);
|
||||
}
|
||||
|
||||
for (int i= cycle.size() - 1; i >= 0; i--) {
|
||||
Component comp = cycle.get(i);
|
||||
|
||||
@ -310,7 +310,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
public boolean dispatchEvent(AWTEvent e) {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE) && (e instanceof WindowEvent || e instanceof FocusEvent)) focusLog.fine("" + e);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE) && (e instanceof WindowEvent || e instanceof FocusEvent)) {
|
||||
focusLog.fine("" + e);
|
||||
}
|
||||
switch (e.getID()) {
|
||||
case WindowEvent.WINDOW_GAINED_FOCUS: {
|
||||
if (repostIfFollowsKeyEvents((WindowEvent)e)) {
|
||||
@ -871,7 +873,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
|
||||
}
|
||||
}
|
||||
if (ke != null) {
|
||||
focusLog.finer("Pumping approved event {0}", ke);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Pumping approved event {0}", ke);
|
||||
}
|
||||
enqueuedKeyEvents.removeFirst();
|
||||
}
|
||||
}
|
||||
@ -920,7 +924,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
|
||||
// The fix is rolled out.
|
||||
|
||||
if (ke.getWhen() > marker.after) {
|
||||
focusLog.finer("Storing event {0} because of marker {1}", ke, marker);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Storing event {0} because of marker {1}", ke, marker);
|
||||
}
|
||||
enqueuedKeyEvents.addLast(ke);
|
||||
return true;
|
||||
}
|
||||
@ -932,7 +938,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
|
||||
}
|
||||
|
||||
case FocusEvent.FOCUS_GAINED:
|
||||
focusLog.finest("Markers before FOCUS_GAINED on {0}", target);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
focusLog.finest("Markers before FOCUS_GAINED on {0}", target);
|
||||
}
|
||||
dumpMarkers();
|
||||
// Search the marker list for the first marker tied to
|
||||
// the Component which just gained focus. Then remove
|
||||
@ -959,7 +967,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
|
||||
}
|
||||
} else {
|
||||
// Exception condition - event without marker
|
||||
focusLog.finer("Event without marker {0}", e);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Event without marker {0}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
focusLog.finest("Markers after FOCUS_GAINED");
|
||||
@ -1198,8 +1208,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
|
||||
return;
|
||||
}
|
||||
|
||||
focusLog.finer("Enqueue at {0} for {1}",
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Enqueue at {0} for {1}",
|
||||
after, untilFocused);
|
||||
}
|
||||
|
||||
int insertionIndex = 0,
|
||||
i = typeAheadMarkers.size();
|
||||
@ -1238,8 +1250,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
|
||||
return;
|
||||
}
|
||||
|
||||
focusLog.finer("Dequeue at {0} for {1}",
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Dequeue at {0} for {1}",
|
||||
after, untilFocused);
|
||||
}
|
||||
|
||||
TypeAheadMarker marker;
|
||||
ListIterator<TypeAheadMarker> iter = typeAheadMarkers.listIterator
|
||||
|
||||
@ -138,7 +138,9 @@ class EventDispatchThread extends Thread {
|
||||
}
|
||||
|
||||
void addEventFilter(EventFilter filter) {
|
||||
eventLog.finest("adding the event filter: " + filter);
|
||||
if (eventLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
eventLog.finest("adding the event filter: " + filter);
|
||||
}
|
||||
synchronized (eventFilters) {
|
||||
if (!eventFilters.contains(filter)) {
|
||||
if (filter instanceof ModalEventFilter) {
|
||||
@ -162,7 +164,9 @@ class EventDispatchThread extends Thread {
|
||||
}
|
||||
|
||||
void removeEventFilter(EventFilter filter) {
|
||||
eventLog.finest("removing the event filter: " + filter);
|
||||
if (eventLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
eventLog.finest("removing the event filter: " + filter);
|
||||
}
|
||||
synchronized (eventFilters) {
|
||||
eventFilters.remove(filter);
|
||||
}
|
||||
|
||||
@ -2410,7 +2410,7 @@ public abstract class KeyboardFocusManager
|
||||
Window nativeFocusedWindow = thisManager.getNativeFocusedWindow();
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("SNFH for {0} in {1}",
|
||||
String.valueOf(descendant), String.valueOf(heavyweight));
|
||||
String.valueOf(descendant), String.valueOf(heavyweight));
|
||||
}
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
focusLog.finest("0. Current focus owner {0}",
|
||||
@ -2478,9 +2478,10 @@ public abstract class KeyboardFocusManager
|
||||
manager.enqueueKeyEvents(time, descendant);
|
||||
}
|
||||
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST))
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
focusLog.finest("3. SNFH_HANDLED for lightweight" +
|
||||
descendant + " in " + heavyweight);
|
||||
}
|
||||
return SNFH_SUCCESS_HANDLED;
|
||||
} else {
|
||||
if (!focusedWindowChangeAllowed) {
|
||||
@ -2501,8 +2502,9 @@ public abstract class KeyboardFocusManager
|
||||
(hwFocusRequest != null)
|
||||
? hwFocusRequest.heavyweight
|
||||
: nativeFocusedWindow)) {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST))
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
focusLog.finest("4. SNFH_FAILURE for " + descendant);
|
||||
}
|
||||
return SNFH_FAILURE;
|
||||
}
|
||||
}
|
||||
@ -2511,8 +2513,9 @@ public abstract class KeyboardFocusManager
|
||||
heavyweightRequests.add
|
||||
(new HeavyweightFocusRequest(heavyweight, descendant,
|
||||
temporary, cause));
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST))
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
focusLog.finest("5. SNFH_PROCEED for " + descendant);
|
||||
}
|
||||
return SNFH_SUCCESS_PROCEED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,8 +165,10 @@ class WaitDispatchSupport implements SecondaryLoop {
|
||||
*/
|
||||
@Override
|
||||
public boolean enter() {
|
||||
log.fine("enter(): blockingEDT=" + keepBlockingEDT.get() +
|
||||
", blockingCT=" + keepBlockingCT.get());
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("enter(): blockingEDT=" + keepBlockingEDT.get() +
|
||||
", blockingCT=" + keepBlockingCT.get());
|
||||
}
|
||||
|
||||
if (!keepBlockingEDT.compareAndSet(false, true)) {
|
||||
log.fine("The secondary loop is already running, aborting");
|
||||
@ -190,9 +192,13 @@ class WaitDispatchSupport implements SecondaryLoop {
|
||||
|
||||
Thread currentThread = Thread.currentThread();
|
||||
if (currentThread == dispatchThread) {
|
||||
log.finest("On dispatch thread: " + dispatchThread);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("On dispatch thread: " + dispatchThread);
|
||||
}
|
||||
if (interval != 0) {
|
||||
log.finest("scheduling the timer for " + interval + " ms");
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("scheduling the timer for " + interval + " ms");
|
||||
}
|
||||
timer.schedule(timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -207,7 +213,9 @@ class WaitDispatchSupport implements SecondaryLoop {
|
||||
SequencedEvent currentSE = KeyboardFocusManager.
|
||||
getCurrentKeyboardFocusManager().getCurrentSequencedEvent();
|
||||
if (currentSE != null) {
|
||||
log.fine("Dispose current SequencedEvent: " + currentSE);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Dispose current SequencedEvent: " + currentSE);
|
||||
}
|
||||
currentSE.dispose();
|
||||
}
|
||||
// In case the exit() method is called before starting
|
||||
@ -223,7 +231,9 @@ class WaitDispatchSupport implements SecondaryLoop {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
log.finest("On non-dispatch thread: " + currentThread);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("On non-dispatch thread: " + currentThread);
|
||||
}
|
||||
synchronized (getTreeLock()) {
|
||||
if (filter != null) {
|
||||
dispatchThread.addEventFilter(filter);
|
||||
@ -247,9 +257,13 @@ class WaitDispatchSupport implements SecondaryLoop {
|
||||
getTreeLock().wait();
|
||||
}
|
||||
}
|
||||
log.fine("waitDone " + keepBlockingEDT.get() + " " + keepBlockingCT.get());
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("waitDone " + keepBlockingEDT.get() + " " + keepBlockingCT.get());
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
log.fine("Exception caught while waiting: " + e);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Exception caught while waiting: " + e);
|
||||
}
|
||||
} finally {
|
||||
if (filter != null) {
|
||||
dispatchThread.removeEventFilter(filter);
|
||||
@ -270,8 +284,10 @@ class WaitDispatchSupport implements SecondaryLoop {
|
||||
* @inheritDoc
|
||||
*/
|
||||
public boolean exit() {
|
||||
log.fine("exit(): blockingEDT=" + keepBlockingEDT.get() +
|
||||
", blockingCT=" + keepBlockingCT.get());
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("exit(): blockingEDT=" + keepBlockingEDT.get() +
|
||||
", blockingCT=" + keepBlockingCT.get());
|
||||
}
|
||||
if (keepBlockingEDT.compareAndSet(true, false)) {
|
||||
wakeupEDT();
|
||||
return true;
|
||||
@ -295,7 +311,9 @@ class WaitDispatchSupport implements SecondaryLoop {
|
||||
};
|
||||
|
||||
private void wakeupEDT() {
|
||||
log.finest("wakeupEDT(): EDT == " + dispatchThread);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("wakeupEDT(): EDT == " + dispatchThread);
|
||||
}
|
||||
EventQueue eq = dispatchThread.getEventQueue();
|
||||
eq.postEvent(new PeerEvent(this, wakingRunnable, PeerEvent.PRIORITY_EVENT));
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ package java.beans;
|
||||
import com.sun.beans.TypeResolver;
|
||||
import com.sun.beans.WeakCache;
|
||||
import com.sun.beans.finder.ClassFinder;
|
||||
import com.sun.beans.finder.MethodFinder;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
@ -1281,7 +1282,20 @@ public class Introspector {
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
Method method = result[i];
|
||||
if (!method.getDeclaringClass().equals(clz)) {
|
||||
result[i] = null;
|
||||
result[i] = null; // ignore methods declared elsewhere
|
||||
}
|
||||
else {
|
||||
try {
|
||||
method = MethodFinder.findAccessibleMethod(method);
|
||||
Class<?> type = method.getDeclaringClass();
|
||||
result[i] = type.equals(clz) || type.isInterface()
|
||||
? method
|
||||
: null; // ignore methods from superclasses
|
||||
}
|
||||
catch (NoSuchMethodException exception) {
|
||||
// commented out because of 6976577
|
||||
// result[i] = null; // ignore inaccessible methods
|
||||
}
|
||||
}
|
||||
}
|
||||
declaredMethodCache.put(clz, result);
|
||||
|
||||
@ -523,8 +523,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
|
||||
if (bufferStrategy.contentsRestored()) {
|
||||
contentsLost = true;
|
||||
if (LOGGER.isLoggable(PlatformLogger.FINER)) {
|
||||
LOGGER.finer(
|
||||
"prepare: contents restored in prepare");
|
||||
LOGGER.finer("prepare: contents restored in prepare");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,7 +271,9 @@ public class SortingFocusTraversalPolicy
|
||||
// Null result means that we overstepped the limit of the FTP's cycle.
|
||||
// In that case we must quit the cycle, otherwise return the component found.
|
||||
if (afterComp != null) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### FTP returned " + afterComp);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### FTP returned " + afterComp);
|
||||
}
|
||||
return afterComp;
|
||||
}
|
||||
aComponent = provider;
|
||||
@ -279,7 +281,9 @@ public class SortingFocusTraversalPolicy
|
||||
|
||||
List<Component> cycle = getFocusTraversalCycle(aContainer);
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is " + cycle + ", component is " + aComponent);
|
||||
}
|
||||
|
||||
int index = getComponentIndex(cycle, aComponent);
|
||||
|
||||
@ -360,7 +364,9 @@ public class SortingFocusTraversalPolicy
|
||||
// Null result means that we overstepped the limit of the FTP's cycle.
|
||||
// In that case we must quit the cycle, otherwise return the component found.
|
||||
if (beforeComp != null) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### FTP returned " + beforeComp);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### FTP returned " + beforeComp);
|
||||
}
|
||||
return beforeComp;
|
||||
}
|
||||
aComponent = provider;
|
||||
@ -373,7 +379,9 @@ public class SortingFocusTraversalPolicy
|
||||
|
||||
List<Component> cycle = getFocusTraversalCycle(aContainer);
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is " + cycle + ", component is " + aComponent);
|
||||
}
|
||||
|
||||
int index = getComponentIndex(cycle, aComponent);
|
||||
|
||||
@ -424,7 +432,9 @@ public class SortingFocusTraversalPolicy
|
||||
public Component getFirstComponent(Container aContainer) {
|
||||
List<Component> cycle;
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Getting first component in " + aContainer);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Getting first component in " + aContainer);
|
||||
}
|
||||
if (aContainer == null) {
|
||||
throw new IllegalArgumentException("aContainer cannot be null");
|
||||
}
|
||||
@ -436,10 +446,14 @@ public class SortingFocusTraversalPolicy
|
||||
}
|
||||
|
||||
if (cycle.size() == 0) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is empty");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is empty");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is " + cycle);
|
||||
}
|
||||
|
||||
for (Component comp : cycle) {
|
||||
if (accept(comp)) {
|
||||
@ -466,7 +480,9 @@ public class SortingFocusTraversalPolicy
|
||||
*/
|
||||
public Component getLastComponent(Container aContainer) {
|
||||
List<Component> cycle;
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Getting last component in " + aContainer);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Getting last component in " + aContainer);
|
||||
}
|
||||
|
||||
if (aContainer == null) {
|
||||
throw new IllegalArgumentException("aContainer cannot be null");
|
||||
@ -479,10 +495,14 @@ public class SortingFocusTraversalPolicy
|
||||
}
|
||||
|
||||
if (cycle.size() == 0) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is empty");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is empty");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### Cycle is " + cycle);
|
||||
}
|
||||
|
||||
for (int i= cycle.size() - 1; i >= 0; i--) {
|
||||
Component comp = cycle.get(i);
|
||||
|
||||
@ -375,11 +375,13 @@ public final class AWTAutoShutdown implements Runnable {
|
||||
}
|
||||
|
||||
final void dumpPeers(final PlatformLogger aLog) {
|
||||
synchronized (activationLock) {
|
||||
synchronized (mainLock) {
|
||||
aLog.fine("Mapped peers:");
|
||||
for (Object key : peerMap.keySet()) {
|
||||
aLog.fine(key + "->" + peerMap.get(key));
|
||||
if (aLog.isLoggable(PlatformLogger.FINE)) {
|
||||
synchronized (activationLock) {
|
||||
synchronized (mainLock) {
|
||||
aLog.fine("Mapped peers:");
|
||||
for (Object key : peerMap.keySet()) {
|
||||
aLog.fine(key + "->" + peerMap.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ final class DebugSettings {
|
||||
|
||||
// echo the initial property settings to stdout
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("DebugSettings:\n{0}" + this);
|
||||
log.fine("DebugSettings:\n{0}", this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -57,8 +57,9 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
|
||||
public void clearGlobalFocusOwner(Window activeWindow) {
|
||||
if (activeWindow != null) {
|
||||
Component focusOwner = activeWindow.getFocusOwner();
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE))
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("Clearing global focus owner " + focusOwner);
|
||||
}
|
||||
if (focusOwner != null) {
|
||||
FocusEvent fl = new CausedFocusEvent(focusOwner, FocusEvent.FOCUS_LOST, false, null,
|
||||
CausedFocusEvent.Cause.CLEAR_GLOBAL_FOCUS_OWNER);
|
||||
@ -126,16 +127,18 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
|
||||
FocusEvent fl = new CausedFocusEvent(currentOwner, FocusEvent.FOCUS_LOST,
|
||||
false, lightweightChild, cause);
|
||||
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER))
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Posting focus event: " + fl);
|
||||
}
|
||||
SunToolkit.postEvent(SunToolkit.targetToAppContext(currentOwner), fl);
|
||||
}
|
||||
|
||||
FocusEvent fg = new CausedFocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED,
|
||||
false, currentOwner, cause);
|
||||
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER))
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Posting focus event: " + fg);
|
||||
}
|
||||
SunToolkit.postEvent(SunToolkit.targetToAppContext(lightweightChild), fg);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -487,7 +487,9 @@ public abstract class SunToolkit extends Toolkit
|
||||
setSystemGenerated(event);
|
||||
AppContext eventContext = targetToAppContext(event.getSource());
|
||||
if (eventContext != null && !eventContext.equals(appContext)) {
|
||||
log.fine("Event posted on wrong app context : " + event);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Event posted on wrong app context : " + event);
|
||||
}
|
||||
}
|
||||
PostEventQueue postEventQueue =
|
||||
(PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
|
||||
|
||||
@ -387,7 +387,9 @@ public class InputContext extends java.awt.im.InputContext
|
||||
}
|
||||
previousInputMethod = null;
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Current client component " + currentClientComponent);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Current client component " + currentClientComponent);
|
||||
}
|
||||
if (inputMethod instanceof InputMethodAdapter) {
|
||||
((InputMethodAdapter) inputMethod).setClientComponent(currentClientComponent);
|
||||
}
|
||||
@ -884,14 +886,16 @@ public class InputContext extends java.awt.im.InputContext
|
||||
}
|
||||
|
||||
private void logCreationFailed(Throwable throwable) {
|
||||
String errorTextFormat = Toolkit.getProperty("AWT.InputMethodCreationFailed",
|
||||
"Could not create {0}. Reason: {1}");
|
||||
Object[] args =
|
||||
{inputMethodLocator.getDescriptor().getInputMethodDisplayName(null, Locale.getDefault()),
|
||||
throwable.getLocalizedMessage()};
|
||||
MessageFormat mf = new MessageFormat(errorTextFormat);
|
||||
PlatformLogger logger = PlatformLogger.getLogger("sun.awt.im");
|
||||
logger.config(mf.format(args));
|
||||
if (logger.isLoggable(PlatformLogger.CONFIG)) {
|
||||
String errorTextFormat = Toolkit.getProperty("AWT.InputMethodCreationFailed",
|
||||
"Could not create {0}. Reason: {1}");
|
||||
Object[] args =
|
||||
{inputMethodLocator.getDescriptor().getInputMethodDisplayName(null, Locale.getDefault()),
|
||||
throwable.getLocalizedMessage()};
|
||||
MessageFormat mf = new MessageFormat(errorTextFormat);
|
||||
logger.config(mf.format(args));
|
||||
}
|
||||
}
|
||||
|
||||
InputMethodLocator getInputMethodLocator() {
|
||||
|
||||
@ -31,6 +31,7 @@ import java.awt.GraphicsConfiguration;
|
||||
import java.awt.Image;
|
||||
import java.awt.ImageCapabilities;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.VolatileImage;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.Iterator;
|
||||
import sun.java2d.SurfaceData;
|
||||
@ -287,4 +288,18 @@ public abstract class SurfaceManager {
|
||||
flush(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a scale factor of the image. This is utility method, which
|
||||
* fetches information from the SurfaceData of the image.
|
||||
*
|
||||
* @see SurfaceData#getDefaultScale
|
||||
*/
|
||||
public static int getImageScale(final Image img) {
|
||||
if (!(img instanceof VolatileImage)) {
|
||||
return 1;
|
||||
}
|
||||
final SurfaceManager sm = getManager(img);
|
||||
return sm.getPrimarySurfaceData().getDefaultScale();
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +65,8 @@ import java.awt.image.ImageObserver;
|
||||
import java.awt.Transparency;
|
||||
import java.awt.font.GlyphVector;
|
||||
import java.awt.font.TextLayout;
|
||||
|
||||
import sun.awt.image.SurfaceManager;
|
||||
import sun.font.FontDesignMetrics;
|
||||
import sun.font.FontUtilities;
|
||||
import sun.java2d.pipe.PixelDrawPipe;
|
||||
@ -82,14 +84,12 @@ import sun.java2d.loops.CompositeType;
|
||||
import sun.java2d.loops.SurfaceType;
|
||||
import sun.java2d.loops.Blit;
|
||||
import sun.java2d.loops.MaskFill;
|
||||
import sun.font.FontManager;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import sun.java2d.loops.XORComposite;
|
||||
import sun.awt.ConstrainableGraphics;
|
||||
import sun.awt.SunHints;
|
||||
import java.util.Map;
|
||||
import java.util.Iterator;
|
||||
import sun.java2d.DestSurfaceProvider;
|
||||
import sun.misc.PerformanceLogger;
|
||||
|
||||
import java.lang.annotation.Native;
|
||||
@ -228,13 +228,15 @@ public final class SunGraphics2D
|
||||
|
||||
public RenderingHints hints;
|
||||
|
||||
public Region constrainClip; // lightweight bounds
|
||||
public Region constrainClip; // lightweight bounds in pixels
|
||||
public int constrainX;
|
||||
public int constrainY;
|
||||
|
||||
public Region clipRegion;
|
||||
public Shape usrClip;
|
||||
protected Region devClip; // Actual physical drawable
|
||||
protected Region devClip; // Actual physical drawable in pixels
|
||||
|
||||
private final int devScale; // Actual physical scale factor
|
||||
|
||||
// cached state for text rendering
|
||||
private boolean validFontInfo;
|
||||
@ -277,6 +279,12 @@ public final class SunGraphics2D
|
||||
|
||||
validateColor();
|
||||
|
||||
devScale = sd.getDefaultScale();
|
||||
if (devScale != 1) {
|
||||
transform.setToScale(devScale, devScale);
|
||||
invalidateTransform();
|
||||
}
|
||||
|
||||
font = f;
|
||||
if (font == null) {
|
||||
font = defaultFont;
|
||||
@ -339,6 +347,49 @@ public final class SunGraphics2D
|
||||
setDevClip(r.x, r.y, r.width, r.height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constrain rendering for lightweight objects.
|
||||
*/
|
||||
public void constrain(int x, int y, int w, int h, Region region) {
|
||||
if ((x | y) != 0) {
|
||||
translate(x, y);
|
||||
}
|
||||
if (transformState > TRANSFORM_TRANSLATESCALE) {
|
||||
clipRect(0, 0, w, h);
|
||||
return;
|
||||
}
|
||||
// changes parameters according to the current scale and translate.
|
||||
final double scaleX = transform.getScaleX();
|
||||
final double scaleY = transform.getScaleY();
|
||||
x = constrainX = (int) transform.getTranslateX();
|
||||
y = constrainY = (int) transform.getTranslateY();
|
||||
w = Region.dimAdd(x, Region.clipScale(w, scaleX));
|
||||
h = Region.dimAdd(y, Region.clipScale(h, scaleY));
|
||||
|
||||
Region c = constrainClip;
|
||||
if (c == null) {
|
||||
c = Region.getInstanceXYXY(x, y, w, h);
|
||||
} else {
|
||||
c = c.getIntersectionXYXY(x, y, w, h);
|
||||
}
|
||||
if (region != null) {
|
||||
region = region.getScaledRegion(scaleX, scaleY);
|
||||
region = region.getTranslatedRegion(x, y);
|
||||
c = c.getIntersection(region);
|
||||
}
|
||||
|
||||
if (c == constrainClip) {
|
||||
// Common case to ignore
|
||||
return;
|
||||
}
|
||||
|
||||
constrainClip = c;
|
||||
if (!devClip.isInsideQuickCheck(c)) {
|
||||
devClip = devClip.getIntersection(c);
|
||||
validateCompClip();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constrain rendering for lightweight objects.
|
||||
*
|
||||
@ -351,33 +402,9 @@ public final class SunGraphics2D
|
||||
* @exception IllegalStateException If the Graphics
|
||||
* to be constrained has a complex transform.
|
||||
*/
|
||||
@Override
|
||||
public void constrain(int x, int y, int w, int h) {
|
||||
if ((x|y) != 0) {
|
||||
translate(x, y);
|
||||
}
|
||||
if (transformState >= TRANSFORM_TRANSLATESCALE) {
|
||||
clipRect(0, 0, w, h);
|
||||
return;
|
||||
}
|
||||
x = constrainX = transX;
|
||||
y = constrainY = transY;
|
||||
w = Region.dimAdd(x, w);
|
||||
h = Region.dimAdd(y, h);
|
||||
Region c = constrainClip;
|
||||
if (c == null) {
|
||||
c = Region.getInstanceXYXY(x, y, w, h);
|
||||
} else {
|
||||
c = c.getIntersectionXYXY(x, y, w, h);
|
||||
if (c == constrainClip) {
|
||||
// Common case to ignore
|
||||
return;
|
||||
}
|
||||
}
|
||||
constrainClip = c;
|
||||
if (!devClip.isInsideQuickCheck(c)) {
|
||||
devClip = devClip.getIntersection(c);
|
||||
validateCompClip();
|
||||
}
|
||||
constrain(x, y, w, h, null);
|
||||
}
|
||||
|
||||
protected static ValidatePipe invalidpipe = new ValidatePipe();
|
||||
@ -1561,11 +1588,13 @@ public final class SunGraphics2D
|
||||
* @see TransformChain
|
||||
* @see AffineTransform
|
||||
*/
|
||||
@Override
|
||||
public void setTransform(AffineTransform Tx) {
|
||||
if ((constrainX|constrainY) == 0) {
|
||||
if ((constrainX | constrainY) == 0 && devScale == 1) {
|
||||
transform.setTransform(Tx);
|
||||
} else {
|
||||
transform.setToTranslation(constrainX, constrainY);
|
||||
transform.setTransform(devScale, 0, 0, devScale, constrainX,
|
||||
constrainY);
|
||||
transform.concatenate(Tx);
|
||||
}
|
||||
invalidateTransform();
|
||||
@ -1623,12 +1652,15 @@ public final class SunGraphics2D
|
||||
* @see #transform
|
||||
* @see #setTransform
|
||||
*/
|
||||
@Override
|
||||
public AffineTransform getTransform() {
|
||||
if ((constrainX|constrainY) == 0) {
|
||||
if ((constrainX | constrainY) == 0 && devScale == 1) {
|
||||
return new AffineTransform(transform);
|
||||
}
|
||||
AffineTransform tx =
|
||||
AffineTransform.getTranslateInstance(-constrainX, -constrainY);
|
||||
final double invScale = 1.0 / devScale;
|
||||
AffineTransform tx = new AffineTransform(invScale, 0, 0, invScale,
|
||||
-constrainX * invScale,
|
||||
-constrainY * invScale);
|
||||
tx.concatenate(transform);
|
||||
return tx;
|
||||
}
|
||||
@ -3012,6 +3044,37 @@ public final class SunGraphics2D
|
||||
}
|
||||
// end of text rendering methods
|
||||
|
||||
private static boolean isHiDPIImage(final Image img) {
|
||||
return SurfaceManager.getImageScale(img) != 1;
|
||||
}
|
||||
|
||||
private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2,
|
||||
int dy2, int sx1, int sy1, int sx2, int sy2,
|
||||
Color bgcolor, ImageObserver observer) {
|
||||
final int scale = SurfaceManager.getImageScale(img);
|
||||
sx1 = Region.clipScale(sx1, scale);
|
||||
sx2 = Region.clipScale(sx2, scale);
|
||||
sy1 = Region.clipScale(sy1, scale);
|
||||
sy2 = Region.clipScale(sy2, scale);
|
||||
try {
|
||||
return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, sy1,
|
||||
sx2, sy2, bgcolor, observer);
|
||||
} catch (InvalidPipeException e) {
|
||||
try {
|
||||
revalidateAll();
|
||||
return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1,
|
||||
sy1, sx2, sy2, bgcolor, observer);
|
||||
} catch (InvalidPipeException e2) {
|
||||
// Still catching the exception; we are not yet ready to
|
||||
// validate the surfaceData correctly. Fail for now and
|
||||
// try again next time around.
|
||||
return false;
|
||||
}
|
||||
} finally {
|
||||
surfaceData.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws an image scaled to x,y,w,h in nonblocking mode with a
|
||||
* callback object.
|
||||
@ -3025,8 +3088,9 @@ public final class SunGraphics2D
|
||||
* Not part of the advertised API but a useful utility method
|
||||
* to call internally. This is for the case where we are
|
||||
* drawing to/from given coordinates using a given width/height,
|
||||
* but we guarantee that the weidth/height of the src and dest
|
||||
* areas are equal (no scale needed).
|
||||
* but we guarantee that the surfaceData's width/height of the src and dest
|
||||
* areas are equal (no scale needed). Note that this method intentionally
|
||||
* ignore scale factor of the source image, and copy it as is.
|
||||
*/
|
||||
public boolean copyImage(Image img, int dx, int dy, int sx, int sy,
|
||||
int width, int height, Color bgcolor,
|
||||
@ -3064,7 +3128,15 @@ public final class SunGraphics2D
|
||||
if ((width == 0) || (height == 0)) {
|
||||
return true;
|
||||
}
|
||||
if (width == img.getWidth(null) && height == img.getHeight(null)) {
|
||||
|
||||
final int imgW = img.getWidth(null);
|
||||
final int imgH = img.getHeight(null);
|
||||
if (isHiDPIImage(img)) {
|
||||
return drawHiDPIImage(img, x, y, x + width, y + height, 0, 0, imgW,
|
||||
imgH, bg, observer);
|
||||
}
|
||||
|
||||
if (width == imgW && height == imgH) {
|
||||
return copyImage(img, x, y, 0, 0, width, height, bg, observer);
|
||||
}
|
||||
|
||||
@ -3105,6 +3177,13 @@ public final class SunGraphics2D
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isHiDPIImage(img)) {
|
||||
final int imgW = img.getWidth(null);
|
||||
final int imgH = img.getHeight(null);
|
||||
return drawHiDPIImage(img, x, y, x + imgW, y + imgH, 0, 0, imgW,
|
||||
imgH, bg, observer);
|
||||
}
|
||||
|
||||
try {
|
||||
return imagepipe.copyImage(this, img, x, y, bg, observer);
|
||||
} catch (InvalidPipeException e) {
|
||||
@ -3153,6 +3232,11 @@ public final class SunGraphics2D
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isHiDPIImage(img)) {
|
||||
return drawHiDPIImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2,
|
||||
bgcolor, observer);
|
||||
}
|
||||
|
||||
if (((sx2 - sx1) == (dx2 - dx1)) &&
|
||||
((sy2 - sy1) == (dy2 - dy1)))
|
||||
{
|
||||
@ -3231,6 +3315,18 @@ public final class SunGraphics2D
|
||||
return drawImage(img, 0, 0, null, observer);
|
||||
}
|
||||
|
||||
if (isHiDPIImage(img)) {
|
||||
final int w = img.getWidth(null);
|
||||
final int h = img.getHeight(null);
|
||||
final AffineTransform tx = new AffineTransform(transform);
|
||||
transform(xform);
|
||||
boolean result = drawHiDPIImage(img, 0, 0, w, h, 0, 0, w, h, null,
|
||||
observer);
|
||||
transform.setTransform(tx);
|
||||
invalidateTransform();
|
||||
return result;
|
||||
}
|
||||
|
||||
try {
|
||||
return imagepipe.transformImage(this, img, xform, observer);
|
||||
} catch (InvalidPipeException e) {
|
||||
|
||||
@ -1057,4 +1057,14 @@ public abstract class SurfaceData
|
||||
* responsible for returning the appropriate object.
|
||||
*/
|
||||
public abstract Object getDestination();
|
||||
|
||||
/**
|
||||
* Returns default scale factor of the destination surface. Scale factor
|
||||
* describes the mapping between virtual and physical coordinates of the
|
||||
* SurfaceData. If the scale is 2 then virtual pixel coordinates need to be
|
||||
* doubled for physical pixels.
|
||||
*/
|
||||
public int getDefaultScale() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,8 +97,7 @@ public abstract class BufferedContext {
|
||||
private int validatedRGB;
|
||||
private int validatedFlags;
|
||||
private boolean xformInUse;
|
||||
private int transX;
|
||||
private int transY;
|
||||
private AffineTransform transform;
|
||||
|
||||
protected BufferedContext(RenderQueue rq) {
|
||||
this.rq = rq;
|
||||
@ -275,14 +274,11 @@ public abstract class BufferedContext {
|
||||
resetTransform();
|
||||
xformInUse = false;
|
||||
txChanged = true;
|
||||
} else if (sg2d != null) {
|
||||
if (transX != sg2d.transX || transY != sg2d.transY) {
|
||||
txChanged = true;
|
||||
}
|
||||
} else if (sg2d != null && !sg2d.transform.equals(transform)) {
|
||||
txChanged = true;
|
||||
}
|
||||
if (sg2d != null) {
|
||||
transX = sg2d.transX;
|
||||
transY = sg2d.transY;
|
||||
if (sg2d != null && txChanged) {
|
||||
transform = new AffineTransform(sg2d.transform);
|
||||
}
|
||||
} else {
|
||||
setTransform(xform);
|
||||
|
||||
@ -27,9 +27,7 @@ package sun.java2d.pipe;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Transparency;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.NoninvertibleTransformException;
|
||||
@ -38,15 +36,13 @@ import java.awt.image.BufferedImage;
|
||||
import java.awt.image.BufferedImageOp;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.awt.image.DirectColorModel;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.awt.image.IndexColorModel;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.VolatileImage;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.awt.image.ImagingOpException;
|
||||
import sun.awt.SunHints;
|
||||
import sun.awt.image.ImageRepresentation;
|
||||
import sun.awt.image.SurfaceManager;
|
||||
import sun.awt.image.ToolkitImage;
|
||||
import sun.java2d.InvalidPipeException;
|
||||
import sun.java2d.SunGraphics2D;
|
||||
@ -323,15 +319,17 @@ public class DrawImage implements DrawImagePipe
|
||||
BufferedImage makeBufferedImage(Image img, Color bgColor, int type,
|
||||
int sx1, int sy1, int sx2, int sy2)
|
||||
{
|
||||
BufferedImage bimg = new BufferedImage(sx2-sx1, sy2-sy1, type);
|
||||
Graphics2D g2d = bimg.createGraphics();
|
||||
final int width = sx2 - sx1;
|
||||
final int height = sy2 - sy1;
|
||||
final BufferedImage bimg = new BufferedImage(width, height, type);
|
||||
final SunGraphics2D g2d = (SunGraphics2D) bimg.createGraphics();
|
||||
g2d.setComposite(AlphaComposite.Src);
|
||||
if (bgColor != null) {
|
||||
g2d.setColor(bgColor);
|
||||
g2d.fillRect(0, 0, sx2-sx1, sy2-sy1);
|
||||
g2d.fillRect(0, 0, width, height);
|
||||
g2d.setComposite(AlphaComposite.SrcOver);
|
||||
}
|
||||
g2d.drawImage(img, -sx1, -sy1, null);
|
||||
g2d.copyImage(img, 0, 0, sx1, sy1, width, height, null, null);
|
||||
g2d.dispose();
|
||||
return bimg;
|
||||
}
|
||||
@ -737,8 +735,9 @@ public class DrawImage implements DrawImagePipe
|
||||
atfm.scale(m00, m11);
|
||||
atfm.translate(srcX-sx1, srcY-sy1);
|
||||
|
||||
int imgW = img.getWidth(null);
|
||||
int imgH = img.getHeight(null);
|
||||
final int scale = SurfaceManager.getImageScale(img);
|
||||
final int imgW = img.getWidth(null) * scale;
|
||||
final int imgH = img.getHeight(null) * scale;
|
||||
srcW += srcX;
|
||||
srcH += srcY;
|
||||
// Make sure we are not out of bounds
|
||||
|
||||
@ -131,6 +131,28 @@ public class Region {
|
||||
return newv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiply the scale factor {@code sv} and the value {@code v} with
|
||||
* appropriate clipping to the bounds of Integer resolution. If the answer
|
||||
* would be greater than {@code Integer.MAX_VALUE} then {@code
|
||||
* Integer.MAX_VALUE} is returned. If the answer would be less than {@code
|
||||
* Integer.MIN_VALUE} then {@code Integer.MIN_VALUE} is returned. Otherwise
|
||||
* the multiplication is returned.
|
||||
*/
|
||||
public static int clipScale(final int v, final double sv) {
|
||||
if (sv == 1.0) {
|
||||
return v;
|
||||
}
|
||||
final double newv = v * sv;
|
||||
if (newv < Integer.MIN_VALUE) {
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
if (newv > Integer.MAX_VALUE) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return (int) Math.round(newv);
|
||||
}
|
||||
|
||||
protected Region(int lox, int loy, int hix, int hiy) {
|
||||
this.lox = lox;
|
||||
this.loy = loy;
|
||||
@ -348,6 +370,79 @@ public class Region {
|
||||
calcBBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Region object that represents the same list of rectangles as
|
||||
* the current Region object, scaled by the specified sx, sy factors.
|
||||
*/
|
||||
public Region getScaledRegion(final double sx, final double sy) {
|
||||
if (sx == 0 || sy == 0 || this == EMPTY_REGION) {
|
||||
return EMPTY_REGION;
|
||||
}
|
||||
if ((sx == 1.0 && sy == 1.0) || (this == WHOLE_REGION)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
int tlox = clipScale(lox, sx);
|
||||
int tloy = clipScale(loy, sy);
|
||||
int thix = clipScale(hix, sx);
|
||||
int thiy = clipScale(hiy, sy);
|
||||
Region ret = new Region(tlox, tloy, thix, thiy);
|
||||
int bands[] = this.bands;
|
||||
if (bands != null) {
|
||||
int end = endIndex;
|
||||
int newbands[] = new int[end];
|
||||
int i = 0; // index for source bands
|
||||
int j = 0; // index for translated newbands
|
||||
int ncol;
|
||||
while (i < end) {
|
||||
int y1, y2;
|
||||
newbands[j++] = y1 = clipScale(bands[i++], sy);
|
||||
newbands[j++] = y2 = clipScale(bands[i++], sy);
|
||||
newbands[j++] = ncol = bands[i++];
|
||||
int savej = j;
|
||||
if (y1 < y2) {
|
||||
while (--ncol >= 0) {
|
||||
int x1 = clipScale(bands[i++], sx);
|
||||
int x2 = clipScale(bands[i++], sx);
|
||||
if (x1 < x2) {
|
||||
newbands[j++] = x1;
|
||||
newbands[j++] = x2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
i += ncol * 2;
|
||||
}
|
||||
// Did we get any non-empty bands in this row?
|
||||
if (j > savej) {
|
||||
newbands[savej-1] = (j - savej) / 2;
|
||||
} else {
|
||||
j = savej - 3;
|
||||
}
|
||||
}
|
||||
if (j <= 5) {
|
||||
if (j < 5) {
|
||||
// No rows or bands were generated...
|
||||
ret.lox = ret.loy = ret.hix = ret.hiy = 0;
|
||||
} else {
|
||||
// Only generated one single rect in the end...
|
||||
ret.loy = newbands[0];
|
||||
ret.hiy = newbands[1];
|
||||
ret.lox = newbands[3];
|
||||
ret.hix = newbands[4];
|
||||
}
|
||||
// ret.endIndex and ret.bands were never initialized...
|
||||
// ret.endIndex = 0;
|
||||
// ret.newbands = null;
|
||||
} else {
|
||||
// Generated multiple bands and/or multiple rows...
|
||||
ret.endIndex = j;
|
||||
ret.bands = newbands;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Region object that represents the same list of
|
||||
* rectangles as the current Region object, translated by
|
||||
|
||||
@ -2065,7 +2065,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
ret = new NegotiateAuthentication(new HttpCallerInfo(authhdr.getHttpCallerInfo(), "Kerberos"));
|
||||
break;
|
||||
case UNKNOWN:
|
||||
logger.finest("Unknown/Unsupported authentication scheme: " + scheme);
|
||||
if (logger.isLoggable(PlatformLogger.FINEST)) {
|
||||
logger.finest("Unknown/Unsupported authentication scheme: " + scheme);
|
||||
}
|
||||
/*fall through*/
|
||||
default:
|
||||
throw new AssertionError("should not reach here");
|
||||
@ -2222,7 +2224,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
}
|
||||
break;
|
||||
case UNKNOWN:
|
||||
logger.finest("Unknown/Unsupported authentication scheme: " + scheme);
|
||||
if (logger.isLoggable(PlatformLogger.FINEST)) {
|
||||
logger.finest("Unknown/Unsupported authentication scheme: " + scheme);
|
||||
}
|
||||
/*fall through*/
|
||||
default:
|
||||
throw new AssertionError("should not reach here");
|
||||
|
||||
@ -142,6 +142,8 @@ class NTLMAuthenticationProxy {
|
||||
|
||||
static void finest(Exception e) {
|
||||
PlatformLogger logger = HttpURLConnection.getHttpLogger();
|
||||
logger.finest("NTLMAuthenticationProxy: " + e);
|
||||
if (logger.isLoggable(PlatformLogger.FINEST)) {
|
||||
logger.finest("NTLMAuthenticationProxy: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,7 +76,9 @@ public abstract class Negotiator {
|
||||
|
||||
private static void finest(Exception e) {
|
||||
PlatformLogger logger = HttpURLConnection.getHttpLogger();
|
||||
logger.finest("NegotiateAuthentication: " + e);
|
||||
if (logger.isLoggable(PlatformLogger.FINEST)) {
|
||||
logger.finest("NegotiateAuthentication: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,9 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
|
||||
}
|
||||
|
||||
void initXSettings() {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Initializing XAWT XSettings");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Initializing XAWT XSettings");
|
||||
}
|
||||
settings = new XMSelection("_XSETTINGS");
|
||||
settings.addSelectionListener(this);
|
||||
initPerScreenXSettings();
|
||||
@ -66,21 +68,29 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
|
||||
}
|
||||
|
||||
public void ownerDeath(int screen, XMSelection sel, long deadOwner) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Owner " + deadOwner + " died for selection " + sel + " screen "+ screen);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Owner " + deadOwner + " died for selection " + sel + " screen "+ screen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ownerChanged(int screen, XMSelection sel, long newOwner, long data, long timestamp) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("New Owner "+ newOwner + " for selection = " + sel + " screen " +screen );
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("New Owner "+ newOwner + " for selection = " + sel + " screen " +screen );
|
||||
}
|
||||
}
|
||||
|
||||
public void selectionChanged(int screen, XMSelection sel, long owner , XPropertyEvent event) {
|
||||
log.fine("Selection changed on sel " + sel + " screen = " + screen + " owner = " + owner + " event = " + event);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Selection changed on sel " + sel + " screen = " + screen + " owner = " + owner + " event = " + event);
|
||||
}
|
||||
updateXSettings(screen,owner);
|
||||
}
|
||||
|
||||
void initPerScreenXSettings() {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Updating Per XSettings changes");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Updating Per XSettings changes");
|
||||
}
|
||||
|
||||
/*
|
||||
* As toolkit cannot yet cope with per-screen desktop properties,
|
||||
@ -114,7 +124,9 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
|
||||
}
|
||||
|
||||
private Map getUpdatedSettings(final long owner) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("owner =" + owner);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("owner =" + owner);
|
||||
}
|
||||
if (0 == owner) {
|
||||
return null;
|
||||
}
|
||||
@ -128,13 +140,17 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
|
||||
int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||
|
||||
if (status != XConstants.Success || getter.getData() == 0) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("OH OH : getter failed status = " + status );
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("OH OH : getter failed status = " + status );
|
||||
}
|
||||
settings = null;
|
||||
}
|
||||
|
||||
long ptr = getter.getData();
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("noItems = " + getter.getNumberOfItems());
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("noItems = " + getter.getNumberOfItems());
|
||||
}
|
||||
byte array[] = Native.toBytes(ptr,getter.getNumberOfItems());
|
||||
if (array != null) {
|
||||
settings = update(array);
|
||||
|
||||
@ -426,7 +426,7 @@ abstract public class XBaseMenuWindow extends XWindow {
|
||||
try {
|
||||
synchronized(getMenuTreeLock()) {
|
||||
if (showingSubmenu != submenuToShow) {
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Changing showing submenu");
|
||||
}
|
||||
if (showingSubmenu != null) {
|
||||
@ -1122,7 +1122,9 @@ abstract public class XBaseMenuWindow extends XWindow {
|
||||
* that grabs input focus
|
||||
*/
|
||||
void doHandleJavaKeyEvent(KeyEvent event) {
|
||||
if (log.isLoggable(PlatformLogger.FINER)) log.finer(event.toString());
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer(event.toString());
|
||||
}
|
||||
if (event.getID() != KeyEvent.KEY_PRESSED) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -160,7 +160,9 @@ public class XBaseWindow {
|
||||
* with class-specific values and perform post-initialization actions.
|
||||
*/
|
||||
void postInit(XCreateWindowParams params) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("WM name is " + getWMName());
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("WM name is " + getWMName());
|
||||
}
|
||||
updateWMName();
|
||||
|
||||
// Set WM_CLIENT_LEADER property
|
||||
@ -480,7 +482,9 @@ public class XBaseWindow {
|
||||
}
|
||||
|
||||
public void setSizeHints(long flags, int x, int y, int width, int height) {
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags));
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags));
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
XSizeHints hints = getHints();
|
||||
@ -541,8 +545,10 @@ public class XBaseWindow {
|
||||
flags |= XUtilConstants.PWinGravity;
|
||||
hints.set_flags(flags);
|
||||
hints.set_win_gravity((int)XConstants.NorthWestGravity);
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) +
|
||||
", values " + hints);
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) +
|
||||
", values " + hints);
|
||||
}
|
||||
XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData);
|
||||
} finally {
|
||||
XToolkit.awtUnlock();
|
||||
@ -593,7 +599,9 @@ public class XBaseWindow {
|
||||
public void xRequestFocus(long time) {
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()) + " with time " + time);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()) + " with time " + time);
|
||||
}
|
||||
XlibWrapper.XSetInputFocus2(XToolkit.getDisplay(), getWindow(), time);
|
||||
} finally {
|
||||
XToolkit.awtUnlock();
|
||||
@ -602,7 +610,9 @@ public class XBaseWindow {
|
||||
public void xRequestFocus() {
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()));
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()));
|
||||
}
|
||||
XlibWrapper.XSetInputFocus(XToolkit.getDisplay(), getWindow());
|
||||
} finally {
|
||||
XToolkit.awtUnlock();
|
||||
@ -619,7 +629,9 @@ public class XBaseWindow {
|
||||
}
|
||||
|
||||
public void xSetVisible(boolean visible) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting visible on " + this + " to " + visible);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Setting visible on " + this + " to " + visible);
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
this.visible = visible;
|
||||
@ -704,7 +716,9 @@ public class XBaseWindow {
|
||||
insLog.warning("Attempt to resize uncreated window");
|
||||
throw new IllegalStateException("Attempt to resize uncreated window");
|
||||
}
|
||||
insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height);
|
||||
}
|
||||
width = Math.max(MIN_SIZE, width);
|
||||
height = Math.max(MIN_SIZE, height);
|
||||
XToolkit.awtLock();
|
||||
@ -820,7 +834,9 @@ public class XBaseWindow {
|
||||
* The active grab overrides activated automatic grab.
|
||||
*/
|
||||
public boolean grabInput() {
|
||||
grabLog.fine("Grab input on {0}", this);
|
||||
if (grabLog.isLoggable(PlatformLogger.FINE)) {
|
||||
grabLog.fine("Grab input on {0}", this);
|
||||
}
|
||||
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
@ -883,7 +899,9 @@ public class XBaseWindow {
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
XBaseWindow grabWindow = XAwtState.getGrabWindow();
|
||||
grabLog.fine("UnGrab input on {0}", grabWindow);
|
||||
if (grabLog.isLoggable(PlatformLogger.FINE)) {
|
||||
grabLog.fine("UnGrab input on {0}", grabWindow);
|
||||
}
|
||||
if (grabWindow != null) {
|
||||
grabWindow.ungrabInputImpl();
|
||||
if (!XToolkit.getSunAwtDisableGrab()) {
|
||||
@ -1021,7 +1039,9 @@ public class XBaseWindow {
|
||||
}
|
||||
public void handleConfigureNotifyEvent(XEvent xev) {
|
||||
XConfigureEvent xe = xev.get_xconfigure();
|
||||
insLog.finer("Configure, {0}", xe);
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Configure, {0}", xe);
|
||||
}
|
||||
x = xe.get_x();
|
||||
y = xe.get_y();
|
||||
width = xe.get_width();
|
||||
@ -1072,7 +1092,9 @@ public class XBaseWindow {
|
||||
}
|
||||
|
||||
public void dispatchEvent(XEvent xev) {
|
||||
if (eventLog.isLoggable(PlatformLogger.FINEST)) eventLog.finest(xev.toString());
|
||||
if (eventLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
eventLog.finest(xev.toString());
|
||||
}
|
||||
int type = xev.get_type();
|
||||
|
||||
if (isDisposed()) {
|
||||
|
||||
@ -214,7 +214,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
||||
* Called when component receives focus
|
||||
*/
|
||||
public void focusGained(FocusEvent e) {
|
||||
focusLog.fine("{0}", e);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("{0}", e);
|
||||
}
|
||||
bHasFocus = true;
|
||||
}
|
||||
|
||||
@ -222,7 +224,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
||||
* Called when component loses focus
|
||||
*/
|
||||
public void focusLost(FocusEvent e) {
|
||||
focusLog.fine("{0}", e);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("{0}", e);
|
||||
}
|
||||
bHasFocus = false;
|
||||
}
|
||||
|
||||
@ -294,8 +298,10 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
||||
case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
|
||||
// Currently we just generate focus events like we deal with lightweight instead of calling
|
||||
// XSetInputFocus on native window
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Proceeding with request to " +
|
||||
lightweightChild + " in " + target);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Proceeding with request to " +
|
||||
lightweightChild + " in " + target);
|
||||
}
|
||||
/**
|
||||
* The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight
|
||||
* checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet
|
||||
@ -319,7 +325,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
||||
*/
|
||||
boolean res = wpeer.requestWindowFocus(null);
|
||||
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Requested window focus: " + res);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Requested window focus: " + res);
|
||||
}
|
||||
// If parent window can be made focused and has been made focused(synchronously)
|
||||
// then we can proceed with children, otherwise we retreat.
|
||||
if (!(res && parentWindow.isFocused())) {
|
||||
@ -339,13 +347,17 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
||||
}
|
||||
|
||||
private boolean rejectFocusRequestHelper(String logMsg) {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(logMsg);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer(logMsg);
|
||||
}
|
||||
XKeyboardFocusManagerPeer.removeLastFocusRequest(target);
|
||||
return false;
|
||||
}
|
||||
|
||||
void handleJavaFocusEvent(AWTEvent e) {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(e.toString());
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer(e.toString());
|
||||
}
|
||||
if (e.getID() == FocusEvent.FOCUS_GAINED) {
|
||||
focusGained((FocusEvent)e);
|
||||
} else {
|
||||
@ -628,7 +640,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
||||
}
|
||||
|
||||
public void setBackground(Color c) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Set background to " + c);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Set background to " + c);
|
||||
}
|
||||
synchronized (getStateLock()) {
|
||||
background = c;
|
||||
}
|
||||
@ -637,7 +651,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
||||
}
|
||||
|
||||
public void setForeground(Color c) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Set foreground to " + c);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Set foreground to " + c);
|
||||
}
|
||||
synchronized (getStateLock()) {
|
||||
foreground = c;
|
||||
}
|
||||
@ -656,7 +672,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public FontMetrics getFontMetrics(Font font) {
|
||||
if (fontLog.isLoggable(PlatformLogger.FINE)) fontLog.fine("Getting font metrics for " + font);
|
||||
if (fontLog.isLoggable(PlatformLogger.FINE)) {
|
||||
fontLog.fine("Getting font metrics for " + font);
|
||||
}
|
||||
return sun.font.FontDesignMetrics.getMetrics(font);
|
||||
}
|
||||
|
||||
|
||||
@ -115,8 +115,10 @@ public final class XContentWindow extends XWindow {
|
||||
if (in != null) {
|
||||
newBounds.setLocation(-in.left, -in.top);
|
||||
}
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting content bounds {0}, old bounds {1}",
|
||||
newBounds, getBounds());
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("Setting content bounds {0}, old bounds {1}",
|
||||
newBounds, getBounds());
|
||||
}
|
||||
// Fix for 5023533:
|
||||
// Change in the size of the content window means, well, change of the size
|
||||
// Change in the location of the content window means change in insets
|
||||
|
||||
@ -78,7 +78,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
Rectangle bounds = (Rectangle)params.get(BOUNDS);
|
||||
dimensions = new WindowDimensions(bounds, getRealInsets(), false);
|
||||
params.put(BOUNDS, dimensions.getClientRect());
|
||||
insLog.fine("Initial dimensions {0}", dimensions);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("Initial dimensions {0}", dimensions);
|
||||
}
|
||||
|
||||
// Deny default processing of these events on the shell - proxy will take care of
|
||||
// them instead
|
||||
@ -179,7 +181,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Title is " + title);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Title is " + title);
|
||||
}
|
||||
winAttr.title = title;
|
||||
updateWMName();
|
||||
}
|
||||
@ -227,7 +231,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
|
||||
// If we somehow received focus events forward it instead to proxy
|
||||
// FIXME: Shouldn't we instead check for inferrior?
|
||||
focusLog.finer("Received focus event on shell: " + xfe);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Received focus event on shell: " + xfe);
|
||||
}
|
||||
// focusProxy.xRequestFocus();
|
||||
}
|
||||
|
||||
@ -269,7 +275,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
|
||||
}
|
||||
|
||||
insLog.finer("FRAME_EXTENTS: {0}", wm_set_insets);
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("FRAME_EXTENTS: {0}", wm_set_insets);
|
||||
}
|
||||
|
||||
if (wm_set_insets != null) {
|
||||
wm_set_insets = copy(wm_set_insets);
|
||||
@ -296,7 +304,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
|
||||
public void handleReparentNotifyEvent(XEvent xev) {
|
||||
XReparentEvent xe = xev.get_xreparent();
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine(xe.toString());
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine(xe.toString());
|
||||
}
|
||||
reparent_serial = xe.get_serial();
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
@ -335,7 +345,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
// Check if we have insets provided by the WM
|
||||
Insets correctWM = getWMSetInsets(null);
|
||||
if (correctWM != null) {
|
||||
insLog.finer("wm-provided insets {0}", correctWM);
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("wm-provided insets {0}", correctWM);
|
||||
}
|
||||
// If these insets are equal to our current insets - no actions are necessary
|
||||
Insets dimInsets = dimensions.getInsets();
|
||||
if (correctWM.equals(dimInsets)) {
|
||||
@ -348,10 +360,12 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
} else {
|
||||
correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
|
||||
|
||||
if (correctWM != null) {
|
||||
insLog.finer("correctWM {0}", correctWM);
|
||||
} else {
|
||||
insLog.finer("correctWM insets are not available, waiting for configureNotify");
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
if (correctWM != null) {
|
||||
insLog.finer("correctWM {0}", correctWM);
|
||||
} else {
|
||||
insLog.finer("correctWM insets are not available, waiting for configureNotify");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,7 +386,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
* initial insets were wrong (most likely they were).
|
||||
*/
|
||||
Insets correction = difference(correctWM, currentInsets);
|
||||
insLog.finest("Corrention {0}", correction);
|
||||
if (insLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
insLog.finest("Corrention {0}", correction);
|
||||
}
|
||||
if (!isNull(correction)) {
|
||||
currentInsets = copy(correctWM);
|
||||
applyGuessedInsets();
|
||||
@ -382,7 +398,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
//update minimum size hints
|
||||
updateMinSizeHints();
|
||||
}
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Dimensions before reparent: " + dimensions);
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Dimensions before reparent: " + dimensions);
|
||||
}
|
||||
|
||||
dimensions.setInsets(getRealInsets());
|
||||
insets_corrected = true;
|
||||
@ -506,8 +524,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
if (!isReparented() || !isVisible()) {
|
||||
insLog.fine("- not reparented({0}) or not visible({1}), default reshape",
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("- not reparented({0}) or not visible({1}), default reshape",
|
||||
Boolean.valueOf(isReparented()), Boolean.valueOf(visible));
|
||||
}
|
||||
|
||||
// Fix for 6323293.
|
||||
// This actually is needed to preserve compatibility with previous releases -
|
||||
@ -612,9 +632,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
dims.setSize(width, height);
|
||||
break;
|
||||
}
|
||||
if (insLog.isLoggable(PlatformLogger.FINE))
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("For the operation {0} new dimensions are {1}",
|
||||
operationToString(operation), dims);
|
||||
}
|
||||
|
||||
reshape(dims, operation, userReshape);
|
||||
}
|
||||
@ -644,7 +665,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
public void handleConfigureNotifyEvent(XEvent xev) {
|
||||
assert (SunToolkit.isAWTLockHeldByCurrentThread());
|
||||
XConfigureEvent xe = xev.get_xconfigure();
|
||||
insLog.fine("Configure notify {0}", xe);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("Configure notify {0}", xe);
|
||||
}
|
||||
|
||||
// XXX: should really only consider synthetic events, but
|
||||
if (isReparented()) {
|
||||
@ -735,7 +758,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
case XWM.SAWFISH_WM:
|
||||
{
|
||||
Point xlocation = queryXLocation();
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("New X location: {0}", xlocation);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("New X location: {0}", xlocation);
|
||||
}
|
||||
if (xlocation != null) {
|
||||
newLocation = xlocation;
|
||||
}
|
||||
@ -752,8 +777,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
copy(currentInsets),
|
||||
true);
|
||||
|
||||
insLog.finer("Insets are {0}, new dimensions {1}",
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Insets are {0}, new dimensions {1}",
|
||||
currentInsets, newDimensions);
|
||||
}
|
||||
|
||||
checkIfOnNewScreen(newDimensions.getBounds());
|
||||
|
||||
@ -788,8 +815,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
}
|
||||
|
||||
public void setShellBounds(Rectangle rec) {
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell bounds on " +
|
||||
this + " to " + rec);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("Setting shell bounds on " + this + " to " + rec);
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
|
||||
@ -801,8 +829,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
}
|
||||
}
|
||||
public void setShellSize(Rectangle rec) {
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell size on " +
|
||||
this + " to " + rec);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("Setting shell size on " + this + " to " + rec);
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
|
||||
@ -813,8 +842,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
}
|
||||
}
|
||||
public void setShellPosition(Rectangle rec) {
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell position on " +
|
||||
this + " to " + rec);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("Setting shell position on " + this + " to " + rec);
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
|
||||
@ -914,9 +944,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
return toGlobal(0,0);
|
||||
} else {
|
||||
Point location = target.getLocation();
|
||||
if (insLog.isLoggable(PlatformLogger.FINE))
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("getLocationOnScreen {0} not reparented: {1} ",
|
||||
this, location);
|
||||
}
|
||||
return location;
|
||||
}
|
||||
} finally {
|
||||
@ -953,7 +984,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
}
|
||||
|
||||
public void setVisible(boolean vis) {
|
||||
log.finer("Setting {0} to visible {1}", this, Boolean.valueOf(vis));
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Setting {0} to visible {1}", this, Boolean.valueOf(vis));
|
||||
}
|
||||
if (vis && !isVisible()) {
|
||||
XWM.setShellDecor(this);
|
||||
super.setVisible(vis);
|
||||
@ -1004,7 +1037,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
}
|
||||
|
||||
private void handleWmTakeFocus(XClientMessageEvent cl) {
|
||||
focusLog.fine("WM_TAKE_FOCUS on {0}", this);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("WM_TAKE_FOCUS on {0}", this);
|
||||
}
|
||||
requestWindowFocus(cl.get_data(1), true);
|
||||
}
|
||||
|
||||
@ -1017,9 +1052,13 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
// by "proxy" - invisible mapped window. When we want to set X input focus to
|
||||
// toplevel set it on proxy instead.
|
||||
if (focusProxy == null) {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.warning("Focus proxy is null for " + this);
|
||||
if (focusLog.isLoggable(PlatformLogger.WARNING)) {
|
||||
focusLog.warning("Focus proxy is null for " + this);
|
||||
}
|
||||
} else {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Requesting focus to proxy: " + focusProxy);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("Requesting focus to proxy: " + focusProxy);
|
||||
}
|
||||
if (timeProvided) {
|
||||
focusProxy.xRequestFocus(time);
|
||||
} else {
|
||||
@ -1111,9 +1150,11 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
Window focusedWindow = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow();
|
||||
Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
|
||||
|
||||
focusLog.finer("Current window is: active={0}, focused={1}",
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Current window is: active={0}, focused={1}",
|
||||
Boolean.valueOf(target == activeWindow),
|
||||
Boolean.valueOf(target == focusedWindow));
|
||||
}
|
||||
|
||||
XWindowPeer toFocus = this;
|
||||
while (toFocus.nextTransientFor != null) {
|
||||
@ -1136,16 +1177,22 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
return true;
|
||||
}
|
||||
Window realNativeFocusedWindow = XWindowPeer.getNativeFocusedWindow();
|
||||
focusLog.finest("Real native focused window: " + realNativeFocusedWindow +
|
||||
if (focusLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
focusLog.finest("Real native focused window: " + realNativeFocusedWindow +
|
||||
"\nKFM's focused window: " + focusedWindow);
|
||||
}
|
||||
|
||||
// See 6522725, 6613426.
|
||||
if (target == realNativeFocusedWindow) {
|
||||
focusLog.fine("The window is already natively focused.");
|
||||
// A workaround for Metacity. See 6522725, 6613426, 7147075.
|
||||
if (target == realNativeFocusedWindow && XWM.getWMID() == XWM.METACITY_WM) {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("The window is already natively focused.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
focusLog.fine("Requesting focus to " + (this == toFocus ? "this window" : toFocus));
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("Requesting focus to " + (this == toFocus ? "this window" : toFocus));
|
||||
}
|
||||
|
||||
if (timeProvided) {
|
||||
toFocus.requestXFocus(time);
|
||||
|
||||
@ -123,7 +123,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
}
|
||||
|
||||
void initDispatching() {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Init embedding for " + Long.toHexString(xembed.handle));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Init embedding for " + Long.toHexString(xembed.handle));
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
XToolkit.addEventDispatcher(xembed.handle, xembed);
|
||||
@ -140,7 +142,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
}
|
||||
|
||||
void endDispatching() {
|
||||
xembedLog.fine("End dispatching for " + Long.toHexString(xembed.handle));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("End dispatching for " + Long.toHexString(xembed.handle));
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
XDropTargetRegistry.getRegistry().unregisterXEmbedClient(getWindow(), xembed.handle);
|
||||
@ -160,7 +164,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
}
|
||||
|
||||
void childDestroyed() {
|
||||
xembedLog.fine("Child " + Long.toHexString(xembed.handle) + " has self-destroyed.");
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Child " + Long.toHexString(xembed.handle) + " has self-destroyed.");
|
||||
}
|
||||
endDispatching();
|
||||
xembed.handle = 0;
|
||||
}
|
||||
@ -382,7 +388,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
}
|
||||
|
||||
void detachChild() {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Detaching child " + Long.toHexString(xembed.handle));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Detaching child " + Long.toHexString(xembed.handle));
|
||||
}
|
||||
/**
|
||||
* XEmbed specification:
|
||||
* "The embedder can unmap the client and reparent the client window to the root window. If the
|
||||
@ -463,7 +471,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
try {
|
||||
XKeyEvent ke = new XKeyEvent(data);
|
||||
ke.set_window(xembed.handle);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Forwarding native key event: " + ke);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Forwarding native key event: " + ke);
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
XlibWrapper.XSendEvent(XToolkit.getDisplay(), xembed.handle, false, XConstants.NoEventMask, data);
|
||||
@ -494,7 +504,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
postEvent(new InvocationEvent(target, new Runnable() {
|
||||
public void run() {
|
||||
GrabbedKey grab = new GrabbedKey(keysym, modifiers);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Grabbing key: " + grab);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Grabbing key: " + grab);
|
||||
}
|
||||
synchronized(GRAB_LOCK) {
|
||||
grabbed_keys.add(grab);
|
||||
}
|
||||
@ -506,7 +518,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
postEvent(new InvocationEvent(target, new Runnable() {
|
||||
public void run() {
|
||||
GrabbedKey grab = new GrabbedKey(keysym, modifiers);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("UnGrabbing key: " + grab);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("UnGrabbing key: " + grab);
|
||||
}
|
||||
synchronized(GRAB_LOCK) {
|
||||
grabbed_keys.remove(grab);
|
||||
}
|
||||
@ -519,7 +533,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
public void run() {
|
||||
AWTKeyStroke stroke = xembed.getKeyStrokeForKeySym(keysym, modifiers);
|
||||
if (stroke != null) {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Registering accelerator " + accel_id + " for " + stroke);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Registering accelerator " + accel_id + " for " + stroke);
|
||||
}
|
||||
synchronized(ACCEL_LOCK) {
|
||||
accelerators.put(accel_id, stroke);
|
||||
accel_lookup.put(stroke, accel_id);
|
||||
@ -537,7 +553,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
synchronized(ACCEL_LOCK) {
|
||||
stroke = accelerators.get(accel_id);
|
||||
if (stroke != null) {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Unregistering accelerator: " + accel_id);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Unregistering accelerator: " + accel_id);
|
||||
}
|
||||
accelerators.remove(accel_id);
|
||||
accel_lookup.remove(stroke); // FIXME: How about several accelerators with the same stroke?
|
||||
}
|
||||
@ -583,7 +601,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
|
||||
boolean result = false;
|
||||
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Post-processing event " + e);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Post-processing event " + e);
|
||||
}
|
||||
|
||||
// Process ACCELERATORS
|
||||
AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
|
||||
@ -596,7 +616,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
}
|
||||
}
|
||||
if (exists) {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Activating accelerator " + accel_id);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Activating accelerator " + accel_id);
|
||||
}
|
||||
xembed.sendMessage(xembed.handle, XEMBED_ACTIVATE_ACCELERATOR, accel_id, 0, 0); // FIXME: How about overloaded?
|
||||
result = true;
|
||||
}
|
||||
@ -608,7 +630,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
exists = grabbed_keys.contains(key);
|
||||
}
|
||||
if (exists) {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Forwarding grabbed key " + e);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Forwarding grabbed key " + e);
|
||||
}
|
||||
forwardKeyEvent(e);
|
||||
result = true;
|
||||
}
|
||||
@ -627,9 +651,13 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
public void handleClientMessage(XEvent xev) {
|
||||
super.handleClientMessage(xev);
|
||||
XClientMessageEvent msg = xev.get_xclient();
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Client message to embedder: " + msg);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Client message to embedder: " + msg);
|
||||
}
|
||||
if (msg.get_message_type() == xembed.XEmbed.getAtom()) {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine(xembed.XEmbedMessageToString(msg));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine(xembed.XEmbedMessageToString(msg));
|
||||
}
|
||||
}
|
||||
if (isXEmbedActive()) {
|
||||
switch ((int)msg.get_data(1)) {
|
||||
@ -730,8 +758,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
boolean new_mapped = (flags & XEMBED_MAPPED) != 0;
|
||||
boolean currently_mapped = XlibUtil.getWindowMapState(handle) != XConstants.IsUnmapped;
|
||||
if (new_mapped != currently_mapped) {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER))
|
||||
xembedLog.fine("Mapping state of the client has changed, old state: " + currently_mapped + ", new state: " + new_mapped);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Mapping state of the client has changed, old state: " + currently_mapped + ", new state: " + new_mapped);
|
||||
}
|
||||
if (new_mapped) {
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
@ -748,7 +777,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
}
|
||||
}
|
||||
} else {
|
||||
xembedLog.finer("Mapping state didn't change, mapped: " + currently_mapped);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Mapping state didn't change, mapped: " + currently_mapped);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} finally {
|
||||
@ -759,7 +790,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
public void handlePropertyNotify(XEvent xev) {
|
||||
if (isXEmbedActive()) {
|
||||
XPropertyEvent ev = xev.get_xproperty();
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Property change on client: " + ev);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Property change on client: " + ev);
|
||||
}
|
||||
if (ev.get_atom() == XAtom.XA_WM_NORMAL_HINTS) {
|
||||
childResized();
|
||||
} else if (ev.get_atom() == XEmbedInfo.getAtom()) {
|
||||
@ -780,7 +813,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
void handleConfigureNotify(XEvent xev) {
|
||||
if (isXEmbedActive()) {
|
||||
XConfigureEvent ev = xev.get_xconfigure();
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Bounds change on client: " + ev);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Bounds change on client: " + ev);
|
||||
}
|
||||
if (xev.get_xany().get_window() == handle) {
|
||||
childResized();
|
||||
}
|
||||
@ -831,7 +866,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
||||
|
||||
// We recognize only these masks
|
||||
modifiers = ke.get_state() & (XConstants.ShiftMask | XConstants.ControlMask | XConstants.LockMask);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINEST)) xembedLog.finest("Mapped " + e + " to " + this);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
xembedLog.finest("Mapped " + e + " to " + this);
|
||||
}
|
||||
} finally {
|
||||
XlibWrapper.unsafe.freeMemory(data);
|
||||
}
|
||||
|
||||
@ -95,9 +95,13 @@ public class XEmbedClientHelper extends XEmbedHelper implements XEventDispatcher
|
||||
|
||||
void handleClientMessage(XEvent xev) {
|
||||
XClientMessageEvent msg = xev.get_xclient();
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine(msg.toString());
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine(msg.toString());
|
||||
}
|
||||
if (msg.get_message_type() == XEmbed.getAtom()) {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Embedded message: " + msgidToString((int)msg.get_data(1)));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Embedded message: " + msgidToString((int)msg.get_data(1)));
|
||||
}
|
||||
switch ((int)msg.get_data(1)) {
|
||||
case XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start
|
||||
active = true;
|
||||
|
||||
@ -82,11 +82,15 @@ public class XEmbedHelper {
|
||||
XEmbedHelper() {
|
||||
if (XEmbed == null) {
|
||||
XEmbed = XAtom.get("_XEMBED");
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Created atom " + XEmbed.toString());
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Created atom " + XEmbed.toString());
|
||||
}
|
||||
}
|
||||
if (XEmbedInfo == null) {
|
||||
XEmbedInfo = XAtom.get("_XEMBED_INFO");
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Created atom " + XEmbedInfo.toString());
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Created atom " + XEmbedInfo.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +110,9 @@ public class XEmbedHelper {
|
||||
msg.set_data(4, data2);
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Sending " + XEmbedMessageToString(msg));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Sending " + XEmbedMessageToString(msg));
|
||||
}
|
||||
XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XConstants.NoEventMask, msg.pData);
|
||||
}
|
||||
finally {
|
||||
|
||||
@ -81,7 +81,9 @@ public class XEmbedServerTester implements XEventDispatcher {
|
||||
throw new RuntimeException("Can't create robot");
|
||||
}
|
||||
initAccel();
|
||||
xembedLog.finer("XEmbed client(tester), embedder window: " + Long.toHexString(parent));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("XEmbed client(tester), embedder window: " + Long.toHexString(parent));
|
||||
}
|
||||
}
|
||||
|
||||
public static XEmbedServerTester getTester(Rectangle serverBounds[], long parent) {
|
||||
@ -89,12 +91,14 @@ public class XEmbedServerTester implements XEventDispatcher {
|
||||
}
|
||||
|
||||
private void dumpReceivedEvents() {
|
||||
xembedLog.finer("Events received so far:");
|
||||
int pos = 0;
|
||||
for (Integer event : events) {
|
||||
xembedLog.finer((pos++) + ":" + XEmbedHelper.msgidToString(event));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Events received so far:");
|
||||
int pos = 0;
|
||||
for (Integer event : events) {
|
||||
xembedLog.finer((pos++) + ":" + XEmbedHelper.msgidToString(event));
|
||||
}
|
||||
xembedLog.finer("End of event dump");
|
||||
}
|
||||
xembedLog.finer("End of event dump");
|
||||
}
|
||||
|
||||
public void test1_1() {
|
||||
@ -391,7 +395,9 @@ public class XEmbedServerTester implements XEventDispatcher {
|
||||
SubstructureNotifyMask | KeyPressMask)});
|
||||
window = new XBaseWindow(params);
|
||||
|
||||
xembedLog.finer("Created tester window: " + window);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Created tester window: " + window);
|
||||
}
|
||||
|
||||
XToolkit.addEventDispatcher(window.getWindow(), this);
|
||||
updateEmbedInfo();
|
||||
@ -529,18 +535,24 @@ public class XEmbedServerTester implements XEventDispatcher {
|
||||
synchronized(EVENT_LOCK) {
|
||||
// Check for already received events after the request
|
||||
if (checkEventList(position, event) != -1) {
|
||||
xembedLog.finer("The event " + XEmbedHelper.msgidToString(event) + " has already been received");
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("The event " + XEmbedHelper.msgidToString(event) + " has already been received");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (eventReceived == event) {
|
||||
// Already received
|
||||
xembedLog.finer("Already received " + XEmbedHelper.msgidToString(event));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Already received " + XEmbedHelper.msgidToString(event));
|
||||
}
|
||||
return;
|
||||
}
|
||||
eventReceived = -1;
|
||||
eventWaited = event;
|
||||
xembedLog.finer("Waiting for " + XEmbedHelper.msgidToString(event) + " starting from " + position);
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Waiting for " + XEmbedHelper.msgidToString(event) + " starting from " + position);
|
||||
}
|
||||
try {
|
||||
EVENT_LOCK.wait(3000);
|
||||
} catch (InterruptedException ie) {
|
||||
@ -551,7 +563,9 @@ public class XEmbedServerTester implements XEventDispatcher {
|
||||
dumpReceivedEvents();
|
||||
throw new RuntimeException("Didn't receive event " + XEmbedHelper.msgidToString(event) + " but recevied " + XEmbedHelper.msgidToString(eventReceived));
|
||||
} else {
|
||||
xembedLog.finer("Successfully recevied " + XEmbedHelper.msgidToString(event));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Successfully recevied " + XEmbedHelper.msgidToString(event));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -634,7 +648,9 @@ public class XEmbedServerTester implements XEventDispatcher {
|
||||
if (ev.get_type() == ClientMessage) {
|
||||
XClientMessageEvent msg = ev.get_xclient();
|
||||
if (msg.get_message_type() == xembed.XEmbed.getAtom()) {
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Embedded message: " + XEmbedHelper.msgidToString((int)msg.get_data(1)));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINE)) {
|
||||
xembedLog.fine("Embedded message: " + XEmbedHelper.msgidToString((int)msg.get_data(1)));
|
||||
}
|
||||
switch ((int)msg.get_data(1)) {
|
||||
case XEmbedHelper.XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start
|
||||
xembedActive = true;
|
||||
@ -659,10 +675,14 @@ public class XEmbedServerTester implements XEventDispatcher {
|
||||
synchronized(EVENT_LOCK) {
|
||||
events.add((int)msg.get_data(1));
|
||||
|
||||
xembedLog.finer("Tester is waiting for " + XEmbedHelper.msgidToString(eventWaited));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Tester is waiting for " + XEmbedHelper.msgidToString(eventWaited));
|
||||
}
|
||||
if ((int)msg.get_data(1) == eventWaited) {
|
||||
eventReceived = (int)msg.get_data(1);
|
||||
xembedLog.finer("Notifying waiting object for event " + System.identityHashCode(EVENT_LOCK));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Notifying waiting object for event " + System.identityHashCode(EVENT_LOCK));
|
||||
}
|
||||
EVENT_LOCK.notifyAll();
|
||||
}
|
||||
}
|
||||
@ -672,10 +692,14 @@ public class XEmbedServerTester implements XEventDispatcher {
|
||||
int eventID = (int)ev.get_type() | SYSTEM_EVENT_MASK;
|
||||
events.add(eventID);
|
||||
|
||||
xembedLog.finer("Tester is waiting for " + XEmbedHelper.msgidToString(eventWaited) + ", but we received " + ev + "(" + XEmbedHelper.msgidToString(eventID) + ")");
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Tester is waiting for " + XEmbedHelper.msgidToString(eventWaited) + ", but we received " + ev + "(" + XEmbedHelper.msgidToString(eventID) + ")");
|
||||
}
|
||||
if (eventID == eventWaited) {
|
||||
eventReceived = eventID;
|
||||
xembedLog.finer("Notifying waiting object" + System.identityHashCode(EVENT_LOCK));
|
||||
if (xembedLog.isLoggable(PlatformLogger.FINER)) {
|
||||
xembedLog.finer("Notifying waiting object" + System.identityHashCode(EVENT_LOCK));
|
||||
}
|
||||
EVENT_LOCK.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
@ -720,7 +720,9 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
|
||||
}
|
||||
|
||||
File fe = new File(dir).getAbsoluteFile();
|
||||
log.fine("Current directory : " + fe);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Current directory : " + fe);
|
||||
}
|
||||
|
||||
if (!fe.isDirectory()) {
|
||||
dir = "./";
|
||||
|
||||
@ -209,7 +209,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
|
||||
}
|
||||
|
||||
public void setMaximizedBounds(Rectangle b) {
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting maximized bounds to " + b);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("Setting maximized bounds to " + b);
|
||||
}
|
||||
if (b == null) return;
|
||||
maxBounds = new Rectangle(b);
|
||||
XToolkit.awtLock();
|
||||
@ -226,7 +228,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
|
||||
} else {
|
||||
hints.set_max_height((int)XlibWrapper.DisplayHeight(XToolkit.getDisplay(), XlibWrapper.DefaultScreen(XToolkit.getDisplay())));
|
||||
}
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags()));
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags()));
|
||||
}
|
||||
XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), window, hints.pData);
|
||||
} finally {
|
||||
XToolkit.awtUnlock();
|
||||
@ -254,14 +258,20 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
|
||||
int changed = state ^ newState;
|
||||
int changeIconic = changed & Frame.ICONIFIED;
|
||||
boolean iconic = (newState & Frame.ICONIFIED) != 0;
|
||||
stateLog.finer("Changing state, old state {0}, new state {1}(iconic {2})",
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) {
|
||||
stateLog.finer("Changing state, old state {0}, new state {1}(iconic {2})",
|
||||
Integer.valueOf(state), Integer.valueOf(newState), Boolean.valueOf(iconic));
|
||||
}
|
||||
if (changeIconic != 0 && iconic) {
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("Iconifying shell " + getShell() + ", this " + this + ", screen " + getScreenNumber());
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) {
|
||||
stateLog.finer("Iconifying shell " + getShell() + ", this " + this + ", screen " + getScreenNumber());
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
int res = XlibWrapper.XIconifyWindow(XToolkit.getDisplay(), getShell(), getScreenNumber());
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("XIconifyWindow returned " + res);
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) {
|
||||
stateLog.finer("XIconifyWindow returned " + res);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
XToolkit.awtUnlock();
|
||||
@ -271,7 +281,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
|
||||
setExtendedState(newState);
|
||||
}
|
||||
if (changeIconic != 0 && !iconic) {
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("DeIconifying " + this);
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) {
|
||||
stateLog.finer("DeIconifying " + this);
|
||||
}
|
||||
xSetVisible(true);
|
||||
}
|
||||
}
|
||||
@ -284,7 +296,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
|
||||
super.handlePropertyNotify(xev);
|
||||
XPropertyEvent ev = xev.get_xproperty();
|
||||
|
||||
log.finer("Property change {0}", ev);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Property change {0}", ev);
|
||||
}
|
||||
/*
|
||||
* Let's see if this is a window state protocol message, and
|
||||
* if it is - decode a new state in terms of java constants.
|
||||
@ -297,7 +311,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
|
||||
final int newState = XWM.getWM().getState(this);
|
||||
int changed = state ^ newState;
|
||||
if (changed == 0) {
|
||||
stateLog.finer("State is the same: " + state);
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) {
|
||||
stateLog.finer("State is the same: " + state);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -349,7 +365,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
|
||||
XWMHints hints = getWMHints();
|
||||
hints.set_flags((int)XUtilConstants.StateHint | hints.get_flags());
|
||||
hints.set_initial_state(wm_state);
|
||||
if (stateLog.isLoggable(PlatformLogger.FINE)) stateLog.fine("Setting initial WM state on " + this + " to " + wm_state);
|
||||
if (stateLog.isLoggable(PlatformLogger.FINE)) {
|
||||
stateLog.fine("Setting initial WM state on " + this + " to " + wm_state);
|
||||
}
|
||||
XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData);
|
||||
}
|
||||
finally {
|
||||
|
||||
@ -61,7 +61,9 @@ public class XIconWindow extends XBaseWindow {
|
||||
final long screen = adata.get_awt_visInfo().get_screen();
|
||||
final long display = XToolkit.getDisplay();
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest(adata.toString());
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest(adata.toString());
|
||||
}
|
||||
|
||||
long status =
|
||||
XlibWrapper.XGetIconSizes(display, XToolkit.getDefaultRootWindow(),
|
||||
@ -71,11 +73,15 @@ public class XIconWindow extends XBaseWindow {
|
||||
}
|
||||
int count = Native.getInt(XlibWrapper.iarg1);
|
||||
long sizes_ptr = Native.getLong(XlibWrapper.larg1); // XIconSize*
|
||||
log.finest("count = {1}, sizes_ptr = {0}", Long.valueOf(sizes_ptr), Integer.valueOf(count));
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("count = {1}, sizes_ptr = {0}", Long.valueOf(sizes_ptr), Integer.valueOf(count));
|
||||
}
|
||||
XIconSize[] res = new XIconSize[count];
|
||||
for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) {
|
||||
res[i] = new XIconSize(sizes_ptr);
|
||||
log.finest("sizes_ptr[{1}] = {0}", res[i], Integer.valueOf(i));
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("sizes_ptr[{1}] = {0}", res[i], Integer.valueOf(i));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
} finally {
|
||||
@ -92,7 +98,9 @@ public class XIconWindow extends XBaseWindow {
|
||||
}
|
||||
|
||||
XIconSize[] sizeList = getIconSizes();
|
||||
log.finest("Icon sizes: {0}", (Object[]) sizeList);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Icon sizes: {0}", (Object[]) sizeList);
|
||||
}
|
||||
if (sizeList == null) {
|
||||
// No icon sizes so we simply fall back to 16x16
|
||||
return new Dimension(16, 16);
|
||||
@ -418,7 +426,9 @@ public class XIconWindow extends XBaseWindow {
|
||||
}
|
||||
}
|
||||
if (min != null) {
|
||||
log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null));
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null));
|
||||
}
|
||||
setIconImage(min);
|
||||
}
|
||||
}
|
||||
@ -444,7 +454,9 @@ public class XIconWindow extends XBaseWindow {
|
||||
}
|
||||
Dimension iconSize = getIconSize(width, height);
|
||||
if (iconSize != null) {
|
||||
log.finest("Icon size: {0}", iconSize);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Icon size: {0}", iconSize);
|
||||
}
|
||||
iconWidth = iconSize.width;
|
||||
iconHeight = iconSize.height;
|
||||
} else {
|
||||
|
||||
@ -102,13 +102,17 @@ public class XInputMethod extends X11InputMethod {
|
||||
protected ComponentPeer getPeer(Component client) {
|
||||
XComponentPeer peer;
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Client is " + client);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Client is " + client);
|
||||
}
|
||||
peer = (XComponentPeer)XToolkit.targetToPeer(client);
|
||||
while (client != null && peer == null) {
|
||||
client = getParent(client);
|
||||
peer = (XComponentPeer)XToolkit.targetToPeer(client);
|
||||
}
|
||||
log.fine("Peer is {0}, client is {1}", peer, client);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Peer is {0}, client is {1}", peer, client);
|
||||
}
|
||||
|
||||
if (peer != null)
|
||||
return peer;
|
||||
|
||||
@ -575,10 +575,14 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
}
|
||||
|
||||
void mousePressed(MouseEvent mouseEvent) {
|
||||
if (log.isLoggable(PlatformLogger.FINER)) log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis);
|
||||
}
|
||||
if (isEnabled() && mouseEvent.getButton() == MouseEvent.BUTTON1) {
|
||||
if (inWindow(mouseEvent.getX(), mouseEvent.getY())) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in items area");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Mouse press in items area");
|
||||
}
|
||||
active = WINDOW;
|
||||
int i = y2index(mouseEvent.getY());
|
||||
if (i >= 0) {
|
||||
@ -615,14 +619,18 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
currentIndex = -1;
|
||||
}
|
||||
} else if (inVerticalScrollbar(mouseEvent.getX(), mouseEvent.getY())) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in vertical scrollbar");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Mouse press in vertical scrollbar");
|
||||
}
|
||||
active = VERSCROLLBAR;
|
||||
vsb.handleMouseEvent(mouseEvent.getID(),
|
||||
mouseEvent.getModifiers(),
|
||||
mouseEvent.getX() - (width - SCROLLBAR_WIDTH),
|
||||
mouseEvent.getY());
|
||||
} else if (inHorizontalScrollbar(mouseEvent.getX(), mouseEvent.getY())) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in horizontal scrollbar");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Mouse press in horizontal scrollbar");
|
||||
}
|
||||
active = HORSCROLLBAR;
|
||||
hsb.handleMouseEvent(mouseEvent.getID(),
|
||||
mouseEvent.getModifiers(),
|
||||
@ -805,7 +813,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
|
||||
void keyPressed(KeyEvent e) {
|
||||
int keyCode = e.getKeyCode();
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine(e.toString());
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine(e.toString());
|
||||
}
|
||||
switch(keyCode) {
|
||||
case KeyEvent.VK_UP:
|
||||
case KeyEvent.VK_KP_UP: // TODO: I assume we also want this, too
|
||||
@ -990,7 +1000,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
*/
|
||||
public void notifyValue(XScrollbar obj, int type, int v, boolean isAdjusting) {
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Notify value changed on " + obj + " to " + v);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Notify value changed on " + obj + " to " + v);
|
||||
}
|
||||
int value = obj.getValue();
|
||||
if (obj == vsb) {
|
||||
scrollVertical(v - value);
|
||||
@ -1073,7 +1085,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (log.isLoggable(PlatformLogger.FINER)) log.finer("Adding item '" + item + "' to " + addedIndex);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Adding item '" + item + "' to " + addedIndex);
|
||||
}
|
||||
|
||||
// Update maxLength
|
||||
boolean repaintItems = !isItemHidden(addedIndex);
|
||||
@ -1091,8 +1105,10 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
| ((vsb.needsRepaint())?(PAINT_VSCROLL):0);
|
||||
|
||||
}
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Last visible: " + getLastVisibleItem() +
|
||||
", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Last visible: " + getLastVisibleItem() +
|
||||
", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems);
|
||||
}
|
||||
repaint(addedIndex, getLastVisibleItem(), options);
|
||||
}
|
||||
|
||||
@ -1107,10 +1123,14 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
boolean vsbWasVisible = vsbVis;
|
||||
int oldLastDisplayed = lastItemDisplayed();
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Deleting from " + s + " to " + e);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Deleting from " + s + " to " + e);
|
||||
}
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() +
|
||||
", size " + items.size());
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() +
|
||||
", size " + items.size());
|
||||
}
|
||||
|
||||
if (items.size() == 0) {
|
||||
return;
|
||||
@ -1177,7 +1197,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
options |= PAINT_FOCUS;
|
||||
}
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Multiple selections: " + multipleSelections);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Multiple selections: " + multipleSelections);
|
||||
}
|
||||
|
||||
// update vsb.val
|
||||
if (vsb.getValue() >= s) {
|
||||
@ -1430,7 +1452,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
* y is the number of items to scroll
|
||||
*/
|
||||
void scrollVertical(int y) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Scrolling vertically by " + y);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Scrolling vertically by " + y);
|
||||
}
|
||||
int itemsInWin = itemsInWindow();
|
||||
int h = getItemHeight();
|
||||
int pixelsToScroll = y * h;
|
||||
@ -1470,7 +1494,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
* x is the number of pixels to scroll
|
||||
*/
|
||||
void scrollHorizontal(int x) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Scrolling horizontally by " + y);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Scrolling horizontally by " + y);
|
||||
}
|
||||
int w = getListWidth();
|
||||
w -= ((2 * SPACE) + (2 * MARGIN));
|
||||
int h = height - (SCROLLBAR_AREA + (2 * MARGIN));
|
||||
@ -1706,7 +1732,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
}
|
||||
|
||||
if (localBuffer == null) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Creating buffer " + width + "x" + height);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Creating buffer " + width + "x" + height);
|
||||
}
|
||||
// use GraphicsConfig.cCVI() instead of Component.cVI(),
|
||||
// because the latter may cause a deadlock with the tree lock
|
||||
localBuffer =
|
||||
@ -1743,7 +1771,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
|
||||
private void paint(Graphics listG, int firstItem, int lastItem, int options,
|
||||
Rectangle source, Point distance) {
|
||||
if (log.isLoggable(PlatformLogger.FINER)) log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options);
|
||||
}
|
||||
if (firstItem > lastItem) {
|
||||
int t = lastItem;
|
||||
lastItem = firstItem;
|
||||
@ -1832,7 +1862,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
}
|
||||
|
||||
private void paintItems(Graphics g, int firstItem, int lastItem, int options) {
|
||||
if (log.isLoggable(PlatformLogger.FINER)) log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem());
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem());
|
||||
}
|
||||
|
||||
firstItem = Math.max(getFirstVisibleItem(), firstItem);
|
||||
if (firstItem > lastItem) {
|
||||
@ -1843,15 +1875,19 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
firstItem = Math.max(getFirstVisibleItem(), firstItem);
|
||||
lastItem = Math.min(lastItem, items.size()-1);
|
||||
|
||||
if (log.isLoggable(PlatformLogger.FINER)) log.finer("Actually painting items from " + firstItem + " to " + lastItem +
|
||||
", items in window " + itemsInWindow());
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Actually painting items from " + firstItem + " to " + lastItem +
|
||||
", items in window " + itemsInWindow());
|
||||
}
|
||||
for (int i = firstItem; i <= lastItem; i++) {
|
||||
paintItem(g, i);
|
||||
}
|
||||
}
|
||||
|
||||
private void paintItem(Graphics g, int index) {
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting item " + index);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Painting item " + index);
|
||||
}
|
||||
// 4895367 - only paint items which are visible
|
||||
if (!isItemHidden(index)) {
|
||||
Shape clip = g.getClip();
|
||||
@ -1859,18 +1895,24 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
int h = getItemHeight();
|
||||
int y = getItemY(index);
|
||||
int x = getItemX();
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Setting clip " + new Rectangle(x, y, w - (SPACE*2), h-(SPACE*2)));
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Setting clip " + new Rectangle(x, y, w - (SPACE*2), h-(SPACE*2)));
|
||||
}
|
||||
g.setClip(x, y, w - (SPACE*2), h-(SPACE*2));
|
||||
|
||||
// Always paint the background so that focus is unpainted in
|
||||
// multiselect mode
|
||||
if (isSelected(index)) {
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painted item is selected");
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Painted item is selected");
|
||||
}
|
||||
g.setColor(getListForeground());
|
||||
} else {
|
||||
g.setColor(getListBackground());
|
||||
}
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Filling " + new Rectangle(x, y, w, h));
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Filling " + new Rectangle(x, y, w, h));
|
||||
}
|
||||
g.fillRect(x, y, w, h);
|
||||
|
||||
if (index <= getLastVisibleItem() && index < items.size()) {
|
||||
@ -1894,8 +1936,10 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
}
|
||||
|
||||
void paintScrollBar(XScrollbar scr, Graphics g, int x, int y, int width, int height, boolean paintAll) {
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting scrollbar " + scr + " width " +
|
||||
width + " height " + height + ", paintAll " + paintAll);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Painting scrollbar " + scr + " width " +
|
||||
width + " height " + height + ", paintAll " + paintAll);
|
||||
}
|
||||
g.translate(x, y);
|
||||
scr.paint(g, getSystemColors(), paintAll);
|
||||
g.translate(-x, -y);
|
||||
@ -1932,22 +1976,30 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
||||
if (paintFocus && !hasFocus()) {
|
||||
paintFocus = false;
|
||||
}
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " +
|
||||
(isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " +
|
||||
(isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus);
|
||||
}
|
||||
Shape clip = g.getClip();
|
||||
g.setClip(0, 0, listWidth, listHeight);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Setting focus clip " + new Rectangle(0, 0, listWidth, listHeight));
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Setting focus clip " + new Rectangle(0, 0, listWidth, listHeight));
|
||||
}
|
||||
Rectangle rect = getFocusRect();
|
||||
if (prevFocusRect != null) {
|
||||
// Erase focus rect
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Erasing previous focus rect " + prevFocusRect);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Erasing previous focus rect " + prevFocusRect);
|
||||
}
|
||||
g.setColor(getListBackground());
|
||||
g.drawRect(prevFocusRect.x, prevFocusRect.y, prevFocusRect.width, prevFocusRect.height);
|
||||
prevFocusRect = null;
|
||||
}
|
||||
if (paintFocus) {
|
||||
// Paint new
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting focus rect " + rect);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Painting focus rect " + rect);
|
||||
}
|
||||
g.setColor(getListForeground()); // Focus color is always black on Linux
|
||||
g.drawRect(rect.x, rect.y, rect.width, rect.height);
|
||||
prevFocusRect = rect;
|
||||
|
||||
@ -128,7 +128,9 @@ public class XMSelection {
|
||||
long display = XToolkit.getDisplay();
|
||||
synchronized(this) {
|
||||
setOwner(owner, screen);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("New Selection Owner for screen " + screen + " = " + owner );
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("New Selection Owner for screen " + screen + " = " + owner );
|
||||
}
|
||||
XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | eventMask);
|
||||
XToolkit.addEventDispatcher(owner,
|
||||
new XEventDispatcher() {
|
||||
@ -148,19 +150,25 @@ public class XMSelection {
|
||||
try {
|
||||
try {
|
||||
long display = XToolkit.getDisplay();
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Grabbing XServer");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Grabbing XServer");
|
||||
}
|
||||
XlibWrapper.XGrabServer(display);
|
||||
|
||||
synchronized(this) {
|
||||
String selection_name = getName()+"_S"+screen;
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Screen = " + screen + " selection name = " + selection_name);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Screen = " + screen + " selection name = " + selection_name);
|
||||
}
|
||||
XAtom atom = XAtom.get(selection_name);
|
||||
selectionMap.put(Long.valueOf(atom.getAtom()),this); // add mapping from atom to the instance of XMSelection
|
||||
setAtom(atom,screen);
|
||||
long owner = XlibWrapper.XGetSelectionOwner(display, atom.getAtom());
|
||||
if (owner != 0) {
|
||||
setOwner(owner, screen);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Selection Owner for screen " + screen + " = " + owner );
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Selection Owner for screen " + screen + " = " + owner );
|
||||
}
|
||||
XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | extra_mask);
|
||||
XToolkit.addEventDispatcher(owner,
|
||||
new XEventDispatcher() {
|
||||
@ -175,7 +183,9 @@ public class XMSelection {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("UnGrabbing XServer");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("UnGrabbing XServer");
|
||||
}
|
||||
XlibWrapper.XUngrabServer(XToolkit.getDisplay());
|
||||
}
|
||||
} finally {
|
||||
@ -187,7 +197,9 @@ public class XMSelection {
|
||||
static boolean processClientMessage(XEvent xev, int screen) {
|
||||
XClientMessageEvent xce = xev.get_xclient();
|
||||
if (xce.get_message_type() == XA_MANAGER.getAtom()) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("client messags = " + xce);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("client messags = " + xce);
|
||||
}
|
||||
long timestamp = xce.get_data(0);
|
||||
long atom = xce.get_data(1);
|
||||
long owner = xce.get_data(2);
|
||||
@ -294,7 +306,9 @@ public class XMSelection {
|
||||
|
||||
|
||||
synchronized void dispatchSelectionChanged( XPropertyEvent ev, int screen) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Selection Changed : Screen = " + screen + "Event =" + ev);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Selection Changed : Screen = " + screen + "Event =" + ev);
|
||||
}
|
||||
if (listeners != null) {
|
||||
Iterator iter = listeners.iterator();
|
||||
while (iter.hasNext()) {
|
||||
@ -305,7 +319,9 @@ public class XMSelection {
|
||||
}
|
||||
|
||||
synchronized void dispatchOwnerDeath(XDestroyWindowEvent de, int screen) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Owner dead : Screen = " + screen + "Event =" + de);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Owner dead : Screen = " + screen + "Event =" + de);
|
||||
}
|
||||
if (listeners != null) {
|
||||
Iterator iter = listeners.iterator();
|
||||
while (iter.hasNext()) {
|
||||
@ -317,7 +333,9 @@ public class XMSelection {
|
||||
}
|
||||
|
||||
void dispatchSelectionEvent(XEvent xev, int screen) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Event =" + xev);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Event =" + xev);
|
||||
}
|
||||
if (xev.get_type() == XConstants.DestroyNotify) {
|
||||
XDestroyWindowEvent de = xev.get_xdestroywindow();
|
||||
dispatchOwnerDeath( de, screen);
|
||||
|
||||
@ -519,7 +519,9 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
|
||||
*/
|
||||
public void handleKeyPress(XEvent xev) {
|
||||
XKeyEvent xkey = xev.get_xkey();
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine(xkey.toString());
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine(xkey.toString());
|
||||
}
|
||||
if (isEventDisabled(xev)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -111,7 +111,9 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer {
|
||||
* for adding separators
|
||||
*/
|
||||
public void addSeparator() {
|
||||
if (log.isLoggable(PlatformLogger.FINER)) log.finer("addSeparator is not implemented");
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("addSeparator is not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem(MenuItem item) {
|
||||
|
||||
@ -43,7 +43,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
}
|
||||
|
||||
public void setState(XWindowPeer window, int state) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting state of " + window + " to " + state);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Setting state of " + window + " to " + state);
|
||||
}
|
||||
if (window.isShowing()) {
|
||||
requestState(window, state);
|
||||
} else {
|
||||
@ -53,7 +55,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
|
||||
private void setInitialState(XWindowPeer window, int state) {
|
||||
XAtomList old_state = window.getNETWMState();
|
||||
log.fine("Current state of the window {0} is {1}", window, old_state);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Current state of the window {0} is {1}", window, old_state);
|
||||
}
|
||||
if ((state & Frame.MAXIMIZED_VERT) != 0) {
|
||||
old_state.add(XA_NET_WM_STATE_MAXIMIZED_VERT);
|
||||
} else {
|
||||
@ -64,7 +68,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
} else {
|
||||
old_state.remove(XA_NET_WM_STATE_MAXIMIZED_HORZ);
|
||||
}
|
||||
log.fine("Setting initial state of the window {0} to {1}", window, old_state);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Setting initial state of the window {0} to {1}", window, old_state);
|
||||
}
|
||||
window.setNETWMState(old_state);
|
||||
}
|
||||
|
||||
@ -97,7 +103,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Requesting state on " + window + " for " + state);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Requesting state on " + window + " for " + state);
|
||||
}
|
||||
req.set_type((int)XConstants.ClientMessage);
|
||||
req.set_window(window.getWindow());
|
||||
req.set_message_type(XA_NET_WM_STATE.getAtom());
|
||||
@ -179,7 +187,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
req.set_data(1, state.getAtom());
|
||||
// Fix for 6735584: req.data[2] must be set to 0 when only one property is changed
|
||||
req.set_data(2, 0);
|
||||
log.fine("Setting _NET_STATE atom {0} on {1} for {2}", state, window, Boolean.valueOf(isAdd));
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Setting _NET_STATE atom {0} on {1} for {2}", state, window, Boolean.valueOf(isAdd));
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
|
||||
@ -204,20 +214,26 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
* @param reset Indicates operation, 'set' if false, 'reset' if true
|
||||
*/
|
||||
private void setStateHelper(XWindowPeer window, XAtom state, boolean set) {
|
||||
log.finer("Window visibility is: withdrawn={0}, visible={1}, mapped={2} showing={3}",
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Window visibility is: withdrawn={0}, visible={1}, mapped={2} showing={3}",
|
||||
Boolean.valueOf(window.isWithdrawn()), Boolean.valueOf(window.isVisible()),
|
||||
Boolean.valueOf(window.isMapped()), Boolean.valueOf(window.isShowing()));
|
||||
}
|
||||
if (window.isShowing()) {
|
||||
requestState(window, state, set);
|
||||
} else {
|
||||
XAtomList net_wm_state = window.getNETWMState();
|
||||
log.finer("Current state on {0} is {1}", window, net_wm_state);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Current state on {0} is {1}", window, net_wm_state);
|
||||
}
|
||||
if (!set) {
|
||||
net_wm_state.remove(state);
|
||||
} else {
|
||||
net_wm_state.add(state);
|
||||
}
|
||||
log.fine("Setting states on {0} to {1}", window, net_wm_state);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Setting states on {0} to {1}", window, net_wm_state);
|
||||
}
|
||||
window.setNETWMState(net_wm_state);
|
||||
}
|
||||
XToolkit.XSync();
|
||||
@ -274,7 +290,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
}
|
||||
NetWindow = checkAnchor(XA_NET_SUPPORTING_WM_CHECK, XAtom.XA_WINDOW);
|
||||
supportChecked = true;
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " is active: " + (NetWindow != 0));
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### " + this + " is active: " + (NetWindow != 0));
|
||||
}
|
||||
}
|
||||
|
||||
boolean active() {
|
||||
@ -284,7 +302,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
|
||||
boolean doStateProtocol() {
|
||||
boolean res = active() && checkProtocol(XA_NET_SUPPORTED, XA_NET_WM_STATE);
|
||||
stateLog.finer("doStateProtocol() returns " + res);
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) {
|
||||
stateLog.finer("doStateProtocol() returns " + res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -311,7 +331,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
if (net_wm_name_string == null) {
|
||||
return false;
|
||||
}
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### WM_NAME = " + net_wm_name_string);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### WM_NAME = " + net_wm_name_string);
|
||||
}
|
||||
return net_wm_name_string.startsWith(name);
|
||||
}
|
||||
|
||||
|
||||
@ -123,7 +123,9 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
||||
* for adding separators
|
||||
*/
|
||||
public void addSeparator() {
|
||||
if (log.isLoggable(PlatformLogger.FINER)) log.finer("addSeparator is not implemented");
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("addSeparator is not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -54,7 +54,9 @@ class XProtocol {
|
||||
} finally {
|
||||
if (firstCheck) {
|
||||
firstCheck = false;
|
||||
log.fine("{0}:{1} supports {2}", this, listName, protocols);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("{0}:{1} supports {2}", this, listName, protocols);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +118,9 @@ abstract class XScrollbar {
|
||||
abstract protected void rebuildArrows();
|
||||
|
||||
public void setSize(int width, int height) {
|
||||
if (log.isLoggable(PlatformLogger.FINER)) log.finer("Setting scroll bar " + this + " size to " + width + "x" + height);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Setting scroll bar " + this + " size to " + width + "x" + height);
|
||||
}
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
@ -164,7 +166,9 @@ abstract class XScrollbar {
|
||||
* @param paintAll paint the whole scrollbar if true, just the thumb is false
|
||||
*/
|
||||
void paint(Graphics g, Color colors[], boolean paintAll) {
|
||||
if (log.isLoggable(PlatformLogger.FINER)) log.finer("Painting scrollbar " + this);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Painting scrollbar " + this);
|
||||
}
|
||||
|
||||
boolean useBufferedImage = false;
|
||||
Graphics2D g2 = null;
|
||||
@ -335,7 +339,9 @@ abstract class XScrollbar {
|
||||
* Tell the scroller to start scrolling.
|
||||
*/
|
||||
void startScrolling() {
|
||||
log.finer("Start scrolling on " + this);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Start scrolling on " + this);
|
||||
}
|
||||
// Make sure that we scroll at least once
|
||||
scroll();
|
||||
|
||||
@ -355,7 +361,9 @@ abstract class XScrollbar {
|
||||
* See 6243382 for more information
|
||||
*/
|
||||
void startScrollingInstance() {
|
||||
log.finer("Start scrolling on " + this);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Start scrolling on " + this);
|
||||
}
|
||||
// Make sure that we scroll at least once
|
||||
scroll();
|
||||
|
||||
@ -368,7 +376,9 @@ abstract class XScrollbar {
|
||||
* See 6243382 for more information
|
||||
*/
|
||||
void stopScrollingInstance() {
|
||||
log.finer("Stop scrolling on " + this);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Stop scrolling on " + this);
|
||||
}
|
||||
|
||||
i_scroller.stop();
|
||||
}
|
||||
|
||||
@ -156,7 +156,9 @@ class XScrollbarPeer extends XComponentPeer implements ScrollbarPeer, XScrollbar
|
||||
|
||||
public void handleJavaKeyEvent(KeyEvent event) {
|
||||
super.handleJavaKeyEvent(event);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) log.finer("KeyEvent on scrollbar: " + event);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("KeyEvent on scrollbar: " + event);
|
||||
}
|
||||
if (!(event.isConsumed()) && event.getID() == KeyEvent.KEY_RELEASED) {
|
||||
switch(event.getKeyCode()) {
|
||||
case KeyEvent.VK_UP:
|
||||
|
||||
@ -58,7 +58,9 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener {
|
||||
long selection_owner = selection.getOwner(SCREEN);
|
||||
available = (selection_owner != XConstants.None);
|
||||
|
||||
log.fine(" check if system tray is available. selection owner: " + selection_owner);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine(" check if system tray is available. selection owner: " + selection_owner);
|
||||
}
|
||||
}
|
||||
|
||||
public void ownerChanged(int screen, XMSelection sel, long newOwner, long data, long timestamp) {
|
||||
@ -106,7 +108,9 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener {
|
||||
void addTrayIcon(XTrayIconPeer tiPeer) throws AWTException {
|
||||
long selection_owner = selection.getOwner(SCREEN);
|
||||
|
||||
log.fine(" send SYSTEM_TRAY_REQUEST_DOCK message to owner: " + selection_owner);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine(" send SYSTEM_TRAY_REQUEST_DOCK message to owner: " + selection_owner);
|
||||
}
|
||||
|
||||
if (selection_owner == XConstants.None) {
|
||||
throw new AWTException("TrayIcon couldn't be displayed.");
|
||||
|
||||
@ -258,7 +258,9 @@ public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
|
||||
}
|
||||
|
||||
public void setBackground(Color c) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("target="+ target + ", old=" + background + ", new=" + c);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("target="+ target + ", old=" + background + ", new=" + c);
|
||||
}
|
||||
background = c;
|
||||
if (xtext != null) {
|
||||
xtext.setBackground(c);
|
||||
|
||||
@ -1492,7 +1492,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
}
|
||||
} catch (InterruptedException ie) {
|
||||
// Note: the returned timeStamp can be incorrect in this case.
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Catched exception, timeStamp may not be correct (ie = " + ie + ")");
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Catched exception, timeStamp may not be correct (ie = " + ie + ")");
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
awtUnlock();
|
||||
@ -1657,7 +1659,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
|
||||
name = "gnome." + name;
|
||||
setDesktopProperty(name, e.getValue());
|
||||
log.fine("name = " + name + " value = " + e.getValue());
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("name = " + name + " value = " + e.getValue());
|
||||
}
|
||||
|
||||
// XXX: we probably want to do something smarter. In
|
||||
// particular, "Net" properties are of interest to the
|
||||
@ -2467,13 +2471,14 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
// Wait for selection notify for oops on win
|
||||
long event_number = getEventNumber();
|
||||
XAtom atom = XAtom.get("WM_S0");
|
||||
eventLog.finer("WM_S0 selection owner {0}", XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom()));
|
||||
if (eventLog.isLoggable(PlatformLogger.FINER)) {
|
||||
eventLog.finer("WM_S0 selection owner {0}", XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom()));
|
||||
}
|
||||
XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
|
||||
XAtom.get("VERSION").getAtom(), oops.getAtom(),
|
||||
win.getWindow(), XConstants.CurrentTime);
|
||||
XSync();
|
||||
|
||||
|
||||
eventLog.finer("Requested OOPS");
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
@ -106,9 +106,11 @@ public class XTrayIconPeer implements TrayIconPeer,
|
||||
|
||||
XConfigureEvent ce = ev.get_xconfigure();
|
||||
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}: {1}x{2}+{3}+{4} (old: {5}+{6})",
|
||||
if (ctrLog.isLoggable(PlatformLogger.FINE)) {
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}: {1}x{2}+{3}+{4} (old: {5}+{6})",
|
||||
XTrayIconPeer.this, ce.get_width(), ce.get_height(),
|
||||
ce.get_x(), ce.get_y(), old_x, old_y);
|
||||
}
|
||||
|
||||
// A workaround for Gnome/Metacity (it doesn't affect the behaviour on KDE).
|
||||
// On Metacity the EmbeddedFrame's parent window bounds are larger
|
||||
@ -128,14 +130,18 @@ public class XTrayIconPeer implements TrayIconPeer,
|
||||
// If both the height and the width differ from the fixed size then WM
|
||||
// must level at least one side to the fixed size. For some reason it may take
|
||||
// a few hops (even after reparenting) and we have to skip the intermediate ones.
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Skipping as intermediate resizing.",
|
||||
if (ctrLog.isLoggable(PlatformLogger.FINE)) {
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Skipping as intermediate resizing.",
|
||||
XTrayIconPeer.this);
|
||||
}
|
||||
return;
|
||||
|
||||
} else if (ce.get_height() > TRAY_ICON_HEIGHT) {
|
||||
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Centering by \"Y\".",
|
||||
if (ctrLog.isLoggable(PlatformLogger.FINE)) {
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Centering by \"Y\".",
|
||||
XTrayIconPeer.this);
|
||||
}
|
||||
|
||||
XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID,
|
||||
ce.get_x(),
|
||||
@ -147,8 +153,10 @@ public class XTrayIconPeer implements TrayIconPeer,
|
||||
|
||||
} else if (ce.get_width() > TRAY_ICON_WIDTH) {
|
||||
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Centering by \"X\".",
|
||||
if (ctrLog.isLoggable(PlatformLogger.FINE)) {
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Centering by \"X\".",
|
||||
XTrayIconPeer.this);
|
||||
}
|
||||
|
||||
XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID,
|
||||
ce.get_x()+ce.get_width()/2 - TRAY_ICON_WIDTH/2,
|
||||
@ -165,8 +173,10 @@ public class XTrayIconPeer implements TrayIconPeer,
|
||||
|
||||
if (ex_height != 0) {
|
||||
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Centering by \"Y\".",
|
||||
if (ctrLog.isLoggable(PlatformLogger.FINE)) {
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Centering by \"Y\".",
|
||||
XTrayIconPeer.this);
|
||||
}
|
||||
|
||||
XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID,
|
||||
ce.get_x(),
|
||||
@ -174,15 +184,19 @@ public class XTrayIconPeer implements TrayIconPeer,
|
||||
|
||||
} else if (ex_width != 0) {
|
||||
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Centering by \"X\".",
|
||||
if (ctrLog.isLoggable(PlatformLogger.FINE)) {
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Centering by \"X\".",
|
||||
XTrayIconPeer.this);
|
||||
}
|
||||
|
||||
XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID,
|
||||
ce.get_x() + ex_width/2 - TRAY_ICON_WIDTH/2,
|
||||
ce.get_y());
|
||||
} else {
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Skipping.",
|
||||
if (ctrLog.isLoggable(PlatformLogger.FINE)) {
|
||||
ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Skipping.",
|
||||
XTrayIconPeer.this);
|
||||
}
|
||||
}
|
||||
}
|
||||
old_x = ce.get_x();
|
||||
|
||||
@ -63,7 +63,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
|
||||
req.set_format(32);
|
||||
req.set_data(0, (WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT));
|
||||
req.set_data(1, win_state);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Sending WIN_STATE to root to change the state to " + win_state);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Sending WIN_STATE to root to change the state to " + win_state);
|
||||
}
|
||||
try {
|
||||
XToolkit.awtLock();
|
||||
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
|
||||
@ -111,7 +113,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
|
||||
win_state &= ~WIN_STATE_MAXIMIZED_HORIZ;
|
||||
}
|
||||
if ((old_win_state ^ win_state) != 0) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting WIN_STATE on " + window + " to change the state to " + win_state);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Setting WIN_STATE on " + window + " to change the state to " + win_state);
|
||||
}
|
||||
XA_WIN_STATE.setCard32Property(window, win_state);
|
||||
}
|
||||
}
|
||||
@ -156,7 +160,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
|
||||
req.set_data(0, layer == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP);
|
||||
req.set_data(1, 0);
|
||||
req.set_data(2, 0);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting layer " + layer + " by root message : " + req);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Setting layer " + layer + " by root message : " + req);
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
|
||||
@ -171,7 +177,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
|
||||
}
|
||||
req.dispose();
|
||||
} else {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting layer property to " + layer);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Setting layer property to " + layer);
|
||||
}
|
||||
XA_WIN_LAYER.setCard32Property(window, layer == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP);
|
||||
}
|
||||
}
|
||||
@ -197,7 +205,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
|
||||
}
|
||||
WinWindow = checkAnchor(XA_WIN_SUPPORTING_WM_CHECK, XAtom.XA_CARDINAL);
|
||||
supportChecked = true;
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " is active: " + (WinWindow != 0));
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### " + this + " is active: " + (WinWindow != 0));
|
||||
}
|
||||
}
|
||||
|
||||
boolean active() {
|
||||
@ -206,13 +216,17 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
|
||||
}
|
||||
boolean doStateProtocol() {
|
||||
boolean res = active() && checkProtocol(XA_WIN_PROTOCOLS, XA_WIN_STATE);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " supports state: " + res);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### " + this + " supports state: " + res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
boolean doLayerProtocol() {
|
||||
boolean res = active() && checkProtocol(XA_WIN_PROTOCOLS, XA_WIN_LAYER);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " supports layer: " + res);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("### " + this + " supports layer: " + res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +148,9 @@ final class XWM
|
||||
XWM(int WMID) {
|
||||
this.WMID = WMID;
|
||||
initializeProtocols();
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Window manager: " + toString());
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Window manager: " + toString());
|
||||
}
|
||||
}
|
||||
int getID() {
|
||||
return WMID;
|
||||
@ -252,7 +254,7 @@ final class XWM
|
||||
* having a window manager running. I.e. it does not reparent
|
||||
* top level shells.
|
||||
*/
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("eXcursion means NO_WM");
|
||||
}
|
||||
return true;
|
||||
@ -270,7 +272,7 @@ final class XWM
|
||||
long selection_owner =
|
||||
XlibWrapper.XGetSelectionOwner(XToolkit.getDisplay(),
|
||||
XAtom.get(selection_name).getAtom());
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("selection owner of " + selection_name
|
||||
+ " is " + selection_owner);
|
||||
}
|
||||
@ -299,7 +301,7 @@ final class XWM
|
||||
XToolkit.getDefaultRootWindow(),
|
||||
XConstants.CWEventMask,
|
||||
substruct.pData);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("It looks like there is no WM thus NO_WM");
|
||||
}
|
||||
}
|
||||
@ -343,18 +345,26 @@ final class XWM
|
||||
byte[] bytes = XlibWrapper.getStringBytes(getter.getData());
|
||||
String id = new String(bytes);
|
||||
|
||||
log.finer("ENLIGHTENMENT_COMMS is " + id);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("ENLIGHTENMENT_COMMS is " + id);
|
||||
}
|
||||
|
||||
// Parse WINID
|
||||
Pattern winIdPat = Pattern.compile("WINID\\s+(\\p{XDigit}{0,8})");
|
||||
try {
|
||||
Matcher match = winIdPat.matcher(id);
|
||||
if (match.matches()) {
|
||||
log.finest("Match group count: " + match.groupCount());
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Match group count: " + match.groupCount());
|
||||
}
|
||||
String longId = match.group(1);
|
||||
log.finest("Match group 1 " + longId);
|
||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||
log.finest("Match group 1 " + longId);
|
||||
}
|
||||
long winid = Long.parseLong(longId, 16);
|
||||
log.finer("Enlightenment communication window " + winid);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Enlightenment communication window " + winid);
|
||||
}
|
||||
return winid;
|
||||
} else {
|
||||
log.finer("ENLIGHTENMENT_COMMS has wrong format");
|
||||
@ -407,7 +417,9 @@ final class XWM
|
||||
static boolean isCDE() {
|
||||
|
||||
if (!XA_DT_SM_WINDOW_INFO.isInterned()) {
|
||||
log.finer("{0} is not interned", XA_DT_SM_WINDOW_INFO);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("{0} is not interned", XA_DT_SM_WINDOW_INFO);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -438,7 +450,9 @@ final class XWM
|
||||
|
||||
/* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */
|
||||
if (!XA_DT_SM_STATE_INFO.isInterned()) {
|
||||
log.finer("{0} is not interned", XA_DT_SM_STATE_INFO);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("{0} is not interned", XA_DT_SM_STATE_INFO);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
WindowPropertyGetter getter2 =
|
||||
@ -610,7 +624,9 @@ final class XWM
|
||||
*/
|
||||
|
||||
if (!XA_ICEWM_WINOPTHINT.isInterned()) {
|
||||
log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -643,7 +659,9 @@ final class XWM
|
||||
*/
|
||||
static boolean isIceWM() {
|
||||
if (!XA_ICEWM_WINOPTHINT.isInterned()) {
|
||||
log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -654,7 +672,9 @@ final class XWM
|
||||
try {
|
||||
int status = getter.execute();
|
||||
boolean res = (status == XConstants.Success && getter.getActualType() != 0);
|
||||
log.finer("Status getting XA_ICEWM_WINOPTHINT: " + !res);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Status getting XA_ICEWM_WINOPTHINT: " + !res);
|
||||
}
|
||||
return !res || isNetWMName("IceWM");
|
||||
} finally {
|
||||
getter.dispose();
|
||||
@ -816,7 +836,9 @@ final class XWM
|
||||
}
|
||||
|
||||
hints.set_flags(hints.get_flags() & ~mask);
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags()));
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags()));
|
||||
}
|
||||
XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(),
|
||||
window.getWindow(),
|
||||
hints.pData);
|
||||
@ -873,7 +895,9 @@ final class XWM
|
||||
|
||||
XAtomList decorDel = new XAtomList();
|
||||
decorations = normalizeMotifDecor(decorations);
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations));
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations));
|
||||
}
|
||||
if ((decorations & MWMConstants.MWM_DECOR_TITLE) == 0) {
|
||||
decorDel.add(XA_OL_DECOR_HEADER);
|
||||
}
|
||||
@ -890,7 +914,9 @@ final class XWM
|
||||
insLog.finer("Deleting OL_DECOR");
|
||||
XA_OL_DECOR_DEL.DeleteProperty(window);
|
||||
} else {
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting OL_DECOR to " + decorDel);
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Setting OL_DECOR to " + decorDel);
|
||||
}
|
||||
XA_OL_DECOR_DEL.setAtomListProperty(window, decorDel);
|
||||
}
|
||||
}
|
||||
@ -918,7 +944,9 @@ final class XWM
|
||||
hints.set_functions(functions);
|
||||
hints.set_decorations(decorations);
|
||||
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("Setting MWM_HINTS to " + hints);
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) {
|
||||
stateLog.finer("Setting MWM_HINTS to " + hints);
|
||||
}
|
||||
window.setMWMHints(hints);
|
||||
}
|
||||
|
||||
@ -980,7 +1008,9 @@ final class XWM
|
||||
* Make specified shell resizable.
|
||||
*/
|
||||
static void setShellResizable(XDecoratedPeer window) {
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell resizable " + window);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("Setting shell resizable " + window);
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
Rectangle shellBounds = window.getShellBounds();
|
||||
@ -1010,8 +1040,10 @@ final class XWM
|
||||
static void setShellNotResizable(XDecoratedPeer window, WindowDimensions newDimensions, Rectangle shellBounds,
|
||||
boolean justChangeSize)
|
||||
{
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions +
|
||||
", shellBounds " + shellBounds +", just change size: " + justChangeSize);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions +
|
||||
", shellBounds " + shellBounds +", just change size: " + justChangeSize);
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
/* Fix min/max size hints at the specified values */
|
||||
@ -1142,7 +1174,9 @@ final class XWM
|
||||
stateLog.finer("WithdrawnState");
|
||||
return false;
|
||||
} else {
|
||||
stateLog.finer("Window WM_STATE is " + wm_state);
|
||||
if (stateLog.isLoggable(PlatformLogger.FINER)) {
|
||||
stateLog.finer("Window WM_STATE is " + wm_state);
|
||||
}
|
||||
}
|
||||
boolean is_state_change = false;
|
||||
if (e.get_atom() == XA_WM_STATE.getAtom()) {
|
||||
@ -1151,7 +1185,9 @@ final class XWM
|
||||
|
||||
for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
|
||||
is_state_change |= proto.isStateChange(e);
|
||||
stateLog.finest(proto + ": is state changed = " + is_state_change);
|
||||
if (stateLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
stateLog.finest(proto + ": is state changed = " + is_state_change);
|
||||
}
|
||||
}
|
||||
return is_state_change;
|
||||
}
|
||||
@ -1303,7 +1339,9 @@ final class XWM
|
||||
res = defaultInsets;
|
||||
}
|
||||
}
|
||||
if (insLog.isLoggable(PlatformLogger.FINEST)) insLog.finest("WM guessed insets: " + res);
|
||||
if (insLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
insLog.finest("WM guessed insets: " + res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/*
|
||||
@ -1372,7 +1410,9 @@ final class XWM
|
||||
XNETProtocol net_protocol = getWM().getNETProtocol();
|
||||
if (net_protocol != null && net_protocol.active()) {
|
||||
Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS);
|
||||
insLog.fine("_NET_FRAME_EXTENTS: {0}", insets);
|
||||
if (insLog.isLoggable(PlatformLogger.FINE)) {
|
||||
insLog.fine("_NET_FRAME_EXTENTS: {0}", insets);
|
||||
}
|
||||
|
||||
if (insets != null) {
|
||||
return insets;
|
||||
@ -1513,7 +1553,9 @@ final class XWM
|
||||
* [mwm, e!, kwin, fvwm2 ... ]
|
||||
*/
|
||||
Insets correctWM = XWM.getInsetsFromExtents(window);
|
||||
insLog.finer("Got insets from property: {0}", correctWM);
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Got insets from property: {0}", correctWM);
|
||||
}
|
||||
|
||||
if (correctWM == null) {
|
||||
correctWM = new Insets(0,0,0,0);
|
||||
@ -1574,7 +1616,9 @@ final class XWM
|
||||
}
|
||||
case XWM.OTHER_WM:
|
||||
default: { /* this is very similar to the E! case above */
|
||||
insLog.finest("Getting correct insets for OTHER_WM/default, parent: {0}", parent);
|
||||
if (insLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
insLog.finest("Getting correct insets for OTHER_WM/default, parent: {0}", parent);
|
||||
}
|
||||
syncTopLevelPos(parent, lwinAttr);
|
||||
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
||||
window, lwinAttr.pData);
|
||||
@ -1601,8 +1645,10 @@ final class XWM
|
||||
&& lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width()
|
||||
&& lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height())
|
||||
{
|
||||
insLog.finest("Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}",
|
||||
if (insLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
insLog.finest("Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}",
|
||||
lwinAttr, pattr, parent, window);
|
||||
}
|
||||
lwinAttr.set_x(pattr.get_x());
|
||||
lwinAttr.set_y(pattr.get_y());
|
||||
lwinAttr.set_border_width(lwinAttr.get_border_width()+pattr.get_border_width());
|
||||
@ -1629,8 +1675,10 @@ final class XWM
|
||||
* widths and inner/outer distinction, so for the time
|
||||
* being, just ignore it.
|
||||
*/
|
||||
insLog.finest("Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}",
|
||||
if (insLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
insLog.finest("Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}",
|
||||
lwinAttr, pattr, parent, window);
|
||||
}
|
||||
correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(),
|
||||
lwinAttr.get_x() + lwinAttr.get_border_width(),
|
||||
pattr.get_height() - (lwinAttr.get_y() + lwinAttr.get_height() + 2*lwinAttr.get_border_width()),
|
||||
|
||||
@ -402,7 +402,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
((Component)e.getSource()).dispatchEvent(e);
|
||||
}
|
||||
}, PeerEvent.ULTIMATE_PRIORITY_EVENT);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER) && (e instanceof FocusEvent)) focusLog.finer("Sending " + e);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER) && (e instanceof FocusEvent)) {
|
||||
focusLog.finer("Sending " + e);
|
||||
}
|
||||
XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), pe);
|
||||
}
|
||||
|
||||
@ -660,7 +662,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
if (isEventDisabled(xev)) {
|
||||
return;
|
||||
}
|
||||
if (eventLog.isLoggable(PlatformLogger.FINE)) eventLog.fine(xbe.toString());
|
||||
if (eventLog.isLoggable(PlatformLogger.FINE)) {
|
||||
eventLog.fine(xbe.toString());
|
||||
}
|
||||
long when;
|
||||
int modifiers;
|
||||
boolean popupTrigger = false;
|
||||
@ -694,9 +698,11 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
/*
|
||||
multiclick checking
|
||||
*/
|
||||
if (eventLog.isLoggable(PlatformLogger.FINEST)) eventLog.finest("lastWindow = " + lastWindow + ", lastButton "
|
||||
+ lastButton + ", lastTime " + lastTime + ", multiClickTime "
|
||||
+ XToolkit.getMultiClickTime());
|
||||
if (eventLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
eventLog.finest("lastWindow = " + lastWindow + ", lastButton "
|
||||
+ lastButton + ", lastTime " + lastTime + ", multiClickTime "
|
||||
+ XToolkit.getMultiClickTime());
|
||||
}
|
||||
if (lastWindow == this && lastButton == lbutton && (when - lastTime) < XToolkit.getMultiClickTime()) {
|
||||
clickCount++;
|
||||
} else {
|
||||
@ -885,7 +891,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
super.handleXCrossingEvent(xev);
|
||||
XCrossingEvent xce = xev.get_xcrossing();
|
||||
|
||||
if (eventLog.isLoggable(PlatformLogger.FINEST)) eventLog.finest(xce.toString());
|
||||
if (eventLog.isLoggable(PlatformLogger.FINEST)) {
|
||||
eventLog.finest(xce.toString());
|
||||
}
|
||||
|
||||
if (xce.get_type() == XConstants.EnterNotify) {
|
||||
enterNotify(xce.get_window());
|
||||
@ -987,8 +995,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
Rectangle oldBounds = getBounds();
|
||||
|
||||
super.handleConfigureNotifyEvent(xev);
|
||||
insLog.finer("Configure, {0}, event disabled: {1}",
|
||||
if (insLog.isLoggable(PlatformLogger.FINER)) {
|
||||
insLog.finer("Configure, {0}, event disabled: {1}",
|
||||
xev.get_xconfigure(), isEventDisabled(xev));
|
||||
}
|
||||
if (isEventDisabled(xev)) {
|
||||
return;
|
||||
}
|
||||
@ -1007,7 +1017,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
|
||||
public void handleMapNotifyEvent(XEvent xev) {
|
||||
super.handleMapNotifyEvent(xev);
|
||||
log.fine("Mapped {0}", this);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Mapped {0}", this);
|
||||
}
|
||||
if (isEventDisabled(xev)) {
|
||||
return;
|
||||
}
|
||||
@ -1029,10 +1041,12 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
}
|
||||
|
||||
private void dumpKeysymArray(XKeyEvent ev) {
|
||||
keyEventLog.fine(" "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 0))+
|
||||
"\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 1))+
|
||||
"\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 2))+
|
||||
"\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 3)));
|
||||
if (keyEventLog.isLoggable(PlatformLogger.FINE)) {
|
||||
keyEventLog.fine(" "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 0))+
|
||||
"\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 1))+
|
||||
"\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 2))+
|
||||
"\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 3)));
|
||||
}
|
||||
}
|
||||
/**
|
||||
Return unicode character or 0 if no correspondent character found.
|
||||
@ -1057,14 +1071,20 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
//return (uni > 0? uni + 0x01000000 : 0);
|
||||
}
|
||||
void logIncomingKeyEvent(XKeyEvent ev) {
|
||||
keyEventLog.fine("--XWindow.java:handleKeyEvent:"+ev);
|
||||
if (keyEventLog.isLoggable(PlatformLogger.FINE)) {
|
||||
keyEventLog.fine("--XWindow.java:handleKeyEvent:"+ev);
|
||||
}
|
||||
dumpKeysymArray(ev);
|
||||
keyEventLog.fine("XXXXXXXXXXXXXX javakeycode will be most probably:0x"+ Integer.toHexString(XKeysym.getJavaKeycodeOnly(ev)));
|
||||
if (keyEventLog.isLoggable(PlatformLogger.FINE)) {
|
||||
keyEventLog.fine("XXXXXXXXXXXXXX javakeycode will be most probably:0x"+ Integer.toHexString(XKeysym.getJavaKeycodeOnly(ev)));
|
||||
}
|
||||
}
|
||||
public void handleKeyPress(XEvent xev) {
|
||||
super.handleKeyPress(xev);
|
||||
XKeyEvent ev = xev.get_xkey();
|
||||
if (eventLog.isLoggable(PlatformLogger.FINE)) eventLog.fine(ev.toString());
|
||||
if (eventLog.isLoggable(PlatformLogger.FINE)) {
|
||||
eventLog.fine(ev.toString());
|
||||
}
|
||||
if (isEventDisabled(xev)) {
|
||||
return;
|
||||
}
|
||||
@ -1153,7 +1173,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
|
||||
|
||||
if (unicodeKey > 0 && !isDeadKey) {
|
||||
keyEventLog.fine("fire _TYPED on "+unicodeKey);
|
||||
if (keyEventLog.isLoggable(PlatformLogger.FINE)) {
|
||||
keyEventLog.fine("fire _TYPED on "+unicodeKey);
|
||||
}
|
||||
postKeyEvent( java.awt.event.KeyEvent.KEY_TYPED,
|
||||
ev.get_time(),
|
||||
java.awt.event.KeyEvent.VK_UNDEFINED,
|
||||
@ -1171,7 +1193,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
public void handleKeyRelease(XEvent xev) {
|
||||
super.handleKeyRelease(xev);
|
||||
XKeyEvent ev = xev.get_xkey();
|
||||
if (eventLog.isLoggable(PlatformLogger.FINE)) eventLog.fine(ev.toString());
|
||||
if (eventLog.isLoggable(PlatformLogger.FINE)) {
|
||||
eventLog.fine(ev.toString());
|
||||
}
|
||||
if (isEventDisabled(xev)) {
|
||||
return;
|
||||
}
|
||||
@ -1333,10 +1357,14 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
void updateSizeHints(int x, int y, int width, int height) {
|
||||
long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition));
|
||||
if (!isResizable()) {
|
||||
log.finer("Window {0} is not resizable", this);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Window {0} is not resizable", this);
|
||||
}
|
||||
flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize;
|
||||
} else {
|
||||
log.finer("Window {0} is resizable", this);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Window {0} is resizable", this);
|
||||
}
|
||||
}
|
||||
setSizeHints(flags, x, y, width, height);
|
||||
}
|
||||
@ -1344,10 +1372,14 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
void updateSizeHints(int x, int y) {
|
||||
long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition);
|
||||
if (!isResizable()) {
|
||||
log.finer("Window {0} is not resizable", this);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Window {0} is not resizable", this);
|
||||
}
|
||||
flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize | XUtilConstants.PSize;
|
||||
} else {
|
||||
log.finer("Window {0} is resizable", this);
|
||||
if (log.isLoggable(PlatformLogger.FINER)) {
|
||||
log.finer("Window {0} is resizable", this);
|
||||
}
|
||||
}
|
||||
setSizeHints(flags, x, y, width, height);
|
||||
}
|
||||
|
||||
@ -227,10 +227,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
if (owner != null) {
|
||||
ownerPeer = (XWindowPeer)owner.getPeer();
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.fine("Owner is " + owner);
|
||||
focusLog.fine("Owner peer is " + ownerPeer);
|
||||
focusLog.fine("Owner X window " + Long.toHexString(ownerPeer.getWindow()));
|
||||
focusLog.fine("Owner content X window " + Long.toHexString(ownerPeer.getContentWindow()));
|
||||
focusLog.finer("Owner is " + owner);
|
||||
focusLog.finer("Owner peer is " + ownerPeer);
|
||||
focusLog.finer("Owner X window " + Long.toHexString(ownerPeer.getWindow()));
|
||||
focusLog.finer("Owner content X window " + Long.toHexString(ownerPeer.getContentWindow()));
|
||||
}
|
||||
// as owner window may be an embedded window, we must get a toplevel window
|
||||
// to set as TRANSIENT_FOR hint
|
||||
@ -239,8 +239,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
// Set WM_TRANSIENT_FOR
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Setting transient on " + Long.toHexString(getWindow())
|
||||
+ " for " + Long.toHexString(ownerWindow));
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("Setting transient on " + Long.toHexString(getWindow())
|
||||
+ " for " + Long.toHexString(ownerWindow));
|
||||
}
|
||||
setToplevelTransientFor(this, ownerPeer, false, true);
|
||||
|
||||
// Set group leader
|
||||
@ -777,7 +779,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
// override_redirect all we can do is check whether our parent
|
||||
// is active. If it is - we can freely synthesize focus transfer.
|
||||
// Luckily, this logic is already implemented in requestWindowFocus.
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Requesting window focus");
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("Requesting window focus");
|
||||
}
|
||||
requestWindowFocus(time, timeProvided);
|
||||
}
|
||||
|
||||
@ -803,7 +807,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
public void handleFocusEvent(XEvent xev) {
|
||||
XFocusChangeEvent xfe = xev.get_xfocus();
|
||||
FocusEvent fe;
|
||||
focusLog.fine("{0}", xfe);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINE)) {
|
||||
focusLog.fine("{0}", xfe);
|
||||
}
|
||||
if (isEventDisabled(xev)) {
|
||||
return;
|
||||
}
|
||||
@ -986,7 +992,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
}
|
||||
|
||||
private void updateAlwaysOnTop() {
|
||||
log.fine("Promoting always-on-top state {0}", Boolean.valueOf(alwaysOnTop));
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Promoting always-on-top state {0}", Boolean.valueOf(alwaysOnTop));
|
||||
}
|
||||
XWM.getWM().setLayer(this,
|
||||
alwaysOnTop ?
|
||||
XLayerProtocol.LAYER_ALWAYS_ON_TOP :
|
||||
@ -1511,7 +1519,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
synchronized(getStateLock()) {
|
||||
XDialogPeer blockerPeer = (XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(d);
|
||||
if (blocked) {
|
||||
log.fine("{0} is blocked by {1}", this, blockerPeer);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("{0} is blocked by {1}", this, blockerPeer);
|
||||
}
|
||||
modalBlocker = d;
|
||||
|
||||
if (isReparented() || XWM.isNonReparentingWM()) {
|
||||
@ -1900,7 +1910,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
|
||||
@Override
|
||||
public void xSetVisible(boolean visible) {
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting visible on " + this + " to " + visible);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("Setting visible on " + this + " to " + visible);
|
||||
}
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
this.visible = visible;
|
||||
@ -2053,7 +2065,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
// since it generates MOUSE_ENTERED/MOUSE_EXITED for frame and dialog.
|
||||
// (fix for 6390326)
|
||||
XBaseWindow target = XToolkit.windowToXWindow(xce.get_window());
|
||||
grabLog.finer(" - Grab event target {0}", target);
|
||||
if (grabLog.isLoggable(PlatformLogger.FINER)) {
|
||||
grabLog.finer(" - Grab event target {0}", target);
|
||||
}
|
||||
if (target != null && target != this) {
|
||||
target.dispatchEvent(xev);
|
||||
return;
|
||||
@ -2064,7 +2078,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
|
||||
public void handleMotionNotify(XEvent xev) {
|
||||
XMotionEvent xme = xev.get_xmotion();
|
||||
if (grabLog.isLoggable(PlatformLogger.FINE)) {
|
||||
if (grabLog.isLoggable(PlatformLogger.FINER)) {
|
||||
grabLog.finer("{0}, when grabbed {1}, contains {2}",
|
||||
xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root()));
|
||||
}
|
||||
@ -2095,7 +2109,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
xme.set_x(localCoord.x);
|
||||
xme.set_y(localCoord.y);
|
||||
}
|
||||
grabLog.finer(" - Grab event target {0}", target);
|
||||
if (grabLog.isLoggable(PlatformLogger.FINER)) {
|
||||
grabLog.finer(" - Grab event target {0}", target);
|
||||
}
|
||||
if (target != null) {
|
||||
if (target != getContentXWindow() && target != this) {
|
||||
target.dispatchEvent(xev);
|
||||
@ -2138,7 +2154,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
// translation)
|
||||
XBaseWindow target = XToolkit.windowToXWindow(xbe.get_window());
|
||||
try {
|
||||
grabLog.finer(" - Grab event target {0} (press target {1})", target, pressTarget);
|
||||
if (grabLog.isLoggable(PlatformLogger.FINER)) {
|
||||
grabLog.finer(" - Grab event target {0} (press target {1})", target, pressTarget);
|
||||
}
|
||||
if (xbe.get_type() == XConstants.ButtonPress
|
||||
&& xbe.get_button() == XConstants.buttons[0])
|
||||
{
|
||||
@ -2172,7 +2190,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
// According to the specification of UngrabEvent, post it
|
||||
// when press occurs outside of the window and not on its owned windows
|
||||
if (xbe.get_type() == XConstants.ButtonPress) {
|
||||
grabLog.fine("Generating UngrabEvent on {0} because not inside of shell", this);
|
||||
if (grabLog.isLoggable(PlatformLogger.FINE)) {
|
||||
grabLog.fine("Generating UngrabEvent on {0} because not inside of shell", this);
|
||||
}
|
||||
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
|
||||
return;
|
||||
}
|
||||
@ -2191,18 +2211,24 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
// toplevel == null - outside of
|
||||
// hierarchy, toplevel is Dialog - should
|
||||
// send ungrab (but shouldn't for Window)
|
||||
grabLog.fine("Generating UngrabEvent on {0} because hierarchy ended", this);
|
||||
if (grabLog.isLoggable(PlatformLogger.FINE)) {
|
||||
grabLog.fine("Generating UngrabEvent on {0} because hierarchy ended", this);
|
||||
}
|
||||
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
|
||||
}
|
||||
} else {
|
||||
// toplevel is null - outside of hierarchy
|
||||
grabLog.fine("Generating UngrabEvent on {0} because toplevel is null", this);
|
||||
if (grabLog.isLoggable(PlatformLogger.FINE)) {
|
||||
grabLog.fine("Generating UngrabEvent on {0} because toplevel is null", this);
|
||||
}
|
||||
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// target doesn't map to XAWT window - outside of hierarchy
|
||||
grabLog.fine("Generating UngrabEvent on because target is null {0}", this);
|
||||
if (grabLog.isLoggable(PlatformLogger.FINE)) {
|
||||
grabLog.fine("Generating UngrabEvent on because target is null {0}", this);
|
||||
}
|
||||
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -806,11 +806,15 @@ public class WrapperGenerator {
|
||||
}
|
||||
}
|
||||
if (s_size_32 != null && !s_size_32.equals(Integer.toString(acc_size_32))) {
|
||||
log.fine("32 bits: The size of the structure " + stp.getName() + " " + s_size_32 +
|
||||
if (log.isLoggable(Level.FINE)) {
|
||||
log.fine("32 bits: The size of the structure " + stp.getName() + " " + s_size_32 +
|
||||
" is not equal to the accumulated size " +acc_size_32 + " of the fields");
|
||||
}
|
||||
} else if (s_size_64 != null && !s_size_64.equals(Integer.toString(acc_size_64))) {
|
||||
log.fine("64 bits: The size of the structure " + stp.getName() + " " +s_size_64+
|
||||
if (log.isLoggable(Level.FINE)) {
|
||||
log.fine("64 bits: The size of the structure " + stp.getName() + " " +s_size_64+
|
||||
" is not equal to the accumulated size " +acc_size_64+" of the fields");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -326,8 +326,10 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
return;
|
||||
|
||||
if (lastXICFocussedComponent != null){
|
||||
if (log.isLoggable(PlatformLogger.FINE)) log.fine("XICFocused {0}, AWTFocused {1}",
|
||||
lastXICFocussedComponent, awtFocussedComponent);
|
||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||
log.fine("XICFocused {0}, AWTFocused {1}",
|
||||
lastXICFocussedComponent, awtFocussedComponent);
|
||||
}
|
||||
}
|
||||
|
||||
if (pData == 0) {
|
||||
|
||||
@ -360,7 +360,9 @@ public abstract class WComponentPeer extends WObjectPeer
|
||||
}
|
||||
|
||||
void handleJavaFocusEvent(FocusEvent fe) {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(fe.toString());
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer(fe.toString());
|
||||
}
|
||||
setFocus(fe.getID() == FocusEvent.FOCUS_GAINED);
|
||||
}
|
||||
|
||||
@ -693,7 +695,9 @@ public abstract class WComponentPeer extends WObjectPeer
|
||||
}
|
||||
boolean res = wpeer.requestWindowFocus(cause);
|
||||
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Requested window focus: " + res);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer("Requested window focus: " + res);
|
||||
}
|
||||
// If parent window can be made focused and has been made focused(synchronously)
|
||||
// then we can proceed with children, otherwise we retreat.
|
||||
if (!(res && parentWindow.isFocused())) {
|
||||
@ -713,7 +717,9 @@ public abstract class WComponentPeer extends WObjectPeer
|
||||
}
|
||||
|
||||
private boolean rejectFocusRequestHelper(String logMsg) {
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(logMsg);
|
||||
if (focusLog.isLoggable(PlatformLogger.FINER)) {
|
||||
focusLog.finer(logMsg);
|
||||
}
|
||||
WKeyboardFocusManagerPeer.removeLastFocusRequest((Component)target);
|
||||
return false;
|
||||
}
|
||||
@ -1080,10 +1086,9 @@ public abstract class WComponentPeer extends WObjectPeer
|
||||
@SuppressWarnings("deprecation")
|
||||
public void applyShape(Region shape) {
|
||||
if (shapeLog.isLoggable(PlatformLogger.FINER)) {
|
||||
shapeLog.finer(
|
||||
"*** INFO: Setting shape: PEER: " + this
|
||||
+ "; TARGET: " + target
|
||||
+ "; SHAPE: " + shape);
|
||||
shapeLog.finer("*** INFO: Setting shape: PEER: " + this
|
||||
+ "; TARGET: " + target
|
||||
+ "; SHAPE: " + shape);
|
||||
}
|
||||
|
||||
if (shape != null) {
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.TexturePaint;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.VolatileImage;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8000629
|
||||
* @summary TexturePaint areas shouldn't separates.
|
||||
* @author Sergey Bylokhov
|
||||
*/
|
||||
public class FillTexturePaint {
|
||||
|
||||
private static TexturePaint shape;
|
||||
private static final int size = 400;
|
||||
|
||||
static {
|
||||
BufferedImage bi = new BufferedImage(50, 50,
|
||||
BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D gi = bi.createGraphics();
|
||||
gi.setBackground(Color.GREEN);
|
||||
gi.clearRect(0, 0, 50, 50);
|
||||
shape = new TexturePaint(bi, new Rectangle(0, 0, 50, 50));
|
||||
}
|
||||
|
||||
public static void main(final String[] args) {
|
||||
GraphicsEnvironment ge =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
GraphicsConfiguration gc =
|
||||
ge.getDefaultScreenDevice().getDefaultConfiguration();
|
||||
VolatileImage vi = gc.createCompatibleVolatileImage(size, size);
|
||||
while (true) {
|
||||
vi.validate(gc);
|
||||
Graphics2D g2d = vi.createGraphics();
|
||||
g2d.setComposite(AlphaComposite.Src);
|
||||
g2d.setPaint(shape);
|
||||
g2d.fill(new Rectangle(0, 0, size, size));
|
||||
g2d.dispose();
|
||||
|
||||
if (vi.validate(gc) != VolatileImage.IMAGE_OK) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
BufferedImage bi = vi.getSnapshot();
|
||||
|
||||
if (vi.contentsLost()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int x = 0; x < size; ++x) {
|
||||
for (int y = 0; y < size; ++y) {
|
||||
if (bi.getRGB(x, y) != Color.GREEN.getRGB()) {
|
||||
throw new RuntimeException("Test failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
105
jdk/test/java/awt/Graphics2D/FlipDrawImage/FlipDrawImage.java
Normal file
105
jdk/test/java/awt/Graphics2D/FlipDrawImage/FlipDrawImage.java
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.VolatileImage;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8000629
|
||||
* @author Sergey Bylokhov
|
||||
*/
|
||||
public final class FlipDrawImage {
|
||||
|
||||
private static final int width = 400;
|
||||
private static final int height = 400;
|
||||
|
||||
public static void main(final String[] args) {
|
||||
GraphicsEnvironment ge =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
GraphicsConfiguration gc =
|
||||
ge.getDefaultScreenDevice().getDefaultConfiguration();
|
||||
VolatileImage vi = gc.createCompatibleVolatileImage(width, height);
|
||||
final BufferedImage bi = new BufferedImage(width, height,
|
||||
BufferedImage.TYPE_INT_ARGB);
|
||||
while (true) {
|
||||
vi.validate(gc);
|
||||
Graphics2D g2d = vi.createGraphics();
|
||||
g2d.setColor(Color.red);
|
||||
g2d.fillRect(0, 0, width, height);
|
||||
g2d.setColor(Color.green);
|
||||
g2d.fillRect(0, 0, width / 2, height / 2);
|
||||
g2d.dispose();
|
||||
|
||||
if (vi.validate(gc) != VolatileImage.IMAGE_OK) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Graphics2D g = bi.createGraphics();
|
||||
g.setComposite(AlphaComposite.Src);
|
||||
g.setColor(Color.BLUE);
|
||||
g.fillRect(0, 0, width, height);
|
||||
// destination width and height are flipped and scale is used.
|
||||
g.drawImage(vi, width / 2, height / 2, -width / 2, -height / 2,
|
||||
null, null);
|
||||
g.dispose();
|
||||
|
||||
if (vi.contentsLost()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int x = 0; x < width; ++x) {
|
||||
for (int y = 0; y < height; ++y) {
|
||||
if (x < width / 2 && y < height / 2) {
|
||||
if (x >= width / 4 && y >= height / 4) {
|
||||
if (bi.getRGB(x, y) != Color.green.getRGB()) {
|
||||
throw new RuntimeException("Test failed.");
|
||||
}
|
||||
} else if (bi.getRGB(x, y) != Color.red.getRGB()) {
|
||||
throw new RuntimeException("Test failed.");
|
||||
}
|
||||
} else {
|
||||
if (bi.getRGB(x, y) != Color.BLUE.getRGB()) {
|
||||
throw new RuntimeException("Test failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.VolatileImage;
|
||||
|
||||
import sun.java2d.SunGraphics2D;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8000629
|
||||
* @summary Set/get transform should work on constrained graphics.
|
||||
* @author Sergey Bylokhov
|
||||
*/
|
||||
public class TransformSetGet {
|
||||
|
||||
public static void main(final String[] args) {
|
||||
final GraphicsEnvironment ge =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
final GraphicsConfiguration gc =
|
||||
ge.getDefaultScreenDevice().getDefaultConfiguration();
|
||||
final VolatileImage vi = gc.createCompatibleVolatileImage(200, 200);
|
||||
final SunGraphics2D sg2d = (SunGraphics2D) vi.createGraphics();
|
||||
|
||||
sg2d.constrain(0, 61, 100, 100);
|
||||
final AffineTransform expected = sg2d.cloneTransform();
|
||||
sg2d.setTransform(sg2d.getTransform());
|
||||
final AffineTransform actual = sg2d.cloneTransform();
|
||||
sg2d.dispose();
|
||||
vi.flush();
|
||||
if (!expected.equals(actual)) {
|
||||
System.out.println("Expected = " + expected);
|
||||
System.out.println("Actual = " + actual);
|
||||
throw new RuntimeException("Wrong transform");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
<html>
|
||||
<!--
|
||||
@test
|
||||
@bug 8010009
|
||||
@summary [macosx] Unable type into online word games on MacOSX
|
||||
@author petr.pchelko : area=awt.keyboard
|
||||
@run clean *
|
||||
@run build TestApplet
|
||||
@run applet/manual=yesno KeyReleasedInAppletTest.html
|
||||
-->
|
||||
<head>
|
||||
<title>KeyReleasedInAppletTest </title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>KeyReleasedInAppletTest<br>Bug ID:8010009 </h1>
|
||||
|
||||
<p> See the dialog box (usually in upper left corner) for instructions</p>
|
||||
|
||||
<APPLET CODE="KeyReleasedInAppletTest.class" WIDTH=200 HEIGHT=200></APPLET>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,235 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextArea;
|
||||
import java.awt.*;
|
||||
import java.awt.FileDialog;
|
||||
import java.awt.Label;
|
||||
import java.awt.event.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.FileWriter;
|
||||
import java.lang.*;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.lang.System;
|
||||
import java.lang.Throwable;
|
||||
import java.util.Hashtable;
|
||||
|
||||
/*
|
||||
@test
|
||||
@bug 8010009
|
||||
@summary [macosx] Unable type into online word games on MacOSX
|
||||
@author petr.pchelko : area=awt.keyboard
|
||||
@run clean *
|
||||
@run build TestApplet
|
||||
@run applet/manual=yesno KeyReleasedInAppletTest.html
|
||||
*/
|
||||
|
||||
public class KeyReleasedInAppletTest extends JApplet {
|
||||
private static final String TEST_HTML_NAME = "TestApplet.html";
|
||||
|
||||
public void init() {
|
||||
//Create instructions for the user here, as well as set up
|
||||
// the environment -- set the layout manager, add buttons,
|
||||
// etc.
|
||||
this.setLayout(new BorderLayout());
|
||||
|
||||
try {
|
||||
String testFilePath = System.getProperty("test.classes");
|
||||
FileWriter testHTML = null;
|
||||
try {
|
||||
testHTML = new FileWriter(testFilePath + "/" + TEST_HTML_NAME);
|
||||
testHTML.write("<html>\n" +
|
||||
"<head>\n" +
|
||||
"<title>KeyReleasedInAppletTest </title>\n" +
|
||||
"</head>\n" +
|
||||
"<body>\n" +
|
||||
"<h1>KeyReleasedInAppletTest<br>Bug ID:8010009 </h1>\n" +
|
||||
"<p>Make sure the applet is focuced and type any character on the keyboard. <br>"+
|
||||
"The applet should show keyPressed, keyTyped and keyReleased messages.</p>\n" +
|
||||
"<APPLET CODE=\"TestApplet.class\" WIDTH=400 HEIGHT=200></APPLET>\n" +
|
||||
"</body>");
|
||||
} finally {
|
||||
if (testHTML != null) {
|
||||
testHTML.close();
|
||||
}
|
||||
}
|
||||
|
||||
String[] instructions =
|
||||
{
|
||||
"(1) Install the tested JDK to be used by the Java Plugin.\n",
|
||||
"(2) Open Java Preferences and set security level to minimal.\n",
|
||||
"(3) Open the " + TEST_HTML_NAME + " in Firefox in firefox web browser\n" +
|
||||
" It is located at: " + testFilePath,
|
||||
"(5) Continue the test according to the instructions in the applet.\n",
|
||||
};
|
||||
Sysout.createDialogWithInstructions(instructions);
|
||||
} catch (Throwable e) {
|
||||
//Fail the test.
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
}//End init()
|
||||
|
||||
public void start() {
|
||||
}// start()
|
||||
}
|
||||
|
||||
/* Place other classes related to the test after this line */
|
||||
|
||||
/****************************************************
|
||||
Standard Test Machinery
|
||||
DO NOT modify anything below -- it's a standard
|
||||
chunk of code whose purpose is to make user
|
||||
interaction uniform, and thereby make it simpler
|
||||
to read and understand someone else's test.
|
||||
****************************************************/
|
||||
|
||||
/**
|
||||
* This is part of the standard test machinery.
|
||||
* It creates a dialog (with the instructions), and is the interface
|
||||
* for sending text messages to the user.
|
||||
* To print the instructions, send an array of strings to Sysout.createDialog
|
||||
* WithInstructions method. Put one line of instructions per array entry.
|
||||
* To display a message for the tester to see, simply call Sysout.println
|
||||
* with the string to be displayed.
|
||||
* This mimics System.out.println but works within the test harness as well
|
||||
* as standalone.
|
||||
*/
|
||||
|
||||
class Sysout {
|
||||
private static TestDialog dialog;
|
||||
private static boolean numbering = false;
|
||||
private static int messageNumber = 0;
|
||||
|
||||
public static void createDialogWithInstructions(String[] instructions) {
|
||||
dialog = new TestDialog(new Frame(), "Instructions");
|
||||
dialog.printInstructions(instructions);
|
||||
dialog.setVisible(true);
|
||||
println("Any messages for the tester will display here.");
|
||||
}
|
||||
|
||||
public static void createDialog() {
|
||||
dialog = new TestDialog(new Frame(), "Instructions");
|
||||
String[] defInstr = {"Instructions will appear here. ", ""};
|
||||
dialog.printInstructions(defInstr);
|
||||
dialog.setVisible(true);
|
||||
println("Any messages for the tester will display here.");
|
||||
}
|
||||
|
||||
/* Enables message counting for the tester. */
|
||||
public static void enableNumbering(boolean enable) {
|
||||
numbering = enable;
|
||||
}
|
||||
|
||||
public static void printInstructions(String[] instructions) {
|
||||
dialog.printInstructions(instructions);
|
||||
}
|
||||
|
||||
|
||||
public static void println(String messageIn) {
|
||||
if (numbering) {
|
||||
messageIn = "" + messageNumber + " " + messageIn;
|
||||
messageNumber++;
|
||||
}
|
||||
dialog.displayMessage(messageIn);
|
||||
}
|
||||
|
||||
}// Sysout class
|
||||
|
||||
/**
|
||||
* This is part of the standard test machinery. It provides a place for the
|
||||
* test instructions to be displayed, and a place for interactive messages
|
||||
* to the user to be displayed.
|
||||
* To have the test instructions displayed, see Sysout.
|
||||
* To have a message to the user be displayed, see Sysout.
|
||||
* Do not call anything in this dialog directly.
|
||||
*/
|
||||
class TestDialog extends Dialog {
|
||||
|
||||
TextArea instructionsText;
|
||||
TextArea messageText;
|
||||
int maxStringLength = 80;
|
||||
|
||||
//DO NOT call this directly, go through Sysout
|
||||
public TestDialog(Frame frame, String name) {
|
||||
super(frame, name);
|
||||
int scrollBoth = TextArea.SCROLLBARS_BOTH;
|
||||
instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
|
||||
add("North", instructionsText);
|
||||
|
||||
messageText = new TextArea("", 5, maxStringLength, scrollBoth);
|
||||
add("Center", messageText);
|
||||
|
||||
pack();
|
||||
|
||||
setVisible(true);
|
||||
}// TestDialog()
|
||||
|
||||
//DO NOT call this directly, go through Sysout
|
||||
public void printInstructions(String[] instructions) {
|
||||
//Clear out any current instructions
|
||||
instructionsText.setText("");
|
||||
|
||||
//Go down array of instruction strings
|
||||
|
||||
String printStr, remainingStr;
|
||||
for (int i = 0; i < instructions.length; i++) {
|
||||
//chop up each into pieces maxSringLength long
|
||||
remainingStr = instructions[i];
|
||||
while (remainingStr.length() > 0) {
|
||||
//if longer than max then chop off first max chars to print
|
||||
if (remainingStr.length() >= maxStringLength) {
|
||||
//Try to chop on a word boundary
|
||||
int posOfSpace = remainingStr.
|
||||
lastIndexOf(' ', maxStringLength - 1);
|
||||
|
||||
if (posOfSpace <= 0) posOfSpace = maxStringLength - 1;
|
||||
|
||||
printStr = remainingStr.substring(0, posOfSpace + 1);
|
||||
remainingStr = remainingStr.substring(posOfSpace + 1);
|
||||
}
|
||||
//else just print
|
||||
else {
|
||||
printStr = remainingStr;
|
||||
remainingStr = "";
|
||||
}
|
||||
|
||||
instructionsText.append(printStr + "\n");
|
||||
|
||||
}// while
|
||||
|
||||
}// for
|
||||
|
||||
}//printInstructions()
|
||||
|
||||
//DO NOT call this directly, go through Sysout
|
||||
public void displayMessage(String messageIn) {
|
||||
messageText.append(messageIn + "\n");
|
||||
System.out.println(messageIn);
|
||||
}
|
||||
|
||||
}// TestDialog class
|
||||
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Label;
|
||||
import java.awt.TextArea;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.lang.String;
|
||||
import java.lang.System;
|
||||
|
||||
|
||||
public class TestApplet extends JApplet {
|
||||
|
||||
public void init() {
|
||||
final TextArea log = new TextArea("Events:\n");
|
||||
log.setEditable(false);
|
||||
log.setSize(400, 200);
|
||||
this.add(log);
|
||||
log.addKeyListener(
|
||||
new KeyAdapter() {
|
||||
@Override public void keyTyped(KeyEvent e) {
|
||||
log.append("Key typed: char = " + e.getKeyChar() + "\n");
|
||||
}
|
||||
|
||||
@Override public void keyPressed(KeyEvent e) {
|
||||
log.append("Key pressed: char = " + e.getKeyChar() + " code = " + e.getKeyCode() + "\n");
|
||||
}
|
||||
|
||||
@Override public void keyReleased(KeyEvent e) {
|
||||
log.append("Key released: char = " + e.getKeyChar() + " code = " + e.getKeyCode() + "\n");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void start() {
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
}
|
||||
102
jdk/test/java/awt/image/DrawImage/IncorrectBounds.java
Normal file
102
jdk/test/java/awt/image/DrawImage/IncorrectBounds.java
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.VolatileImage;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8000629
|
||||
* @summary Temporary backbuffer in the DrawImage should not fill background
|
||||
* outside of source image bounds.
|
||||
* @author Sergey Bylokhov
|
||||
*/
|
||||
public final class IncorrectBounds {
|
||||
|
||||
private static final int width = 400;
|
||||
private static final int height = 400;
|
||||
|
||||
public static void main(final String[] args) {
|
||||
GraphicsEnvironment ge =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
GraphicsConfiguration gc =
|
||||
ge.getDefaultScreenDevice().getDefaultConfiguration();
|
||||
VolatileImage vi = gc.createCompatibleVolatileImage(width / 4,
|
||||
height / 4);
|
||||
final BufferedImage bi = new BufferedImage(width, height,
|
||||
BufferedImage.TYPE_INT_ARGB);
|
||||
while (true) {
|
||||
vi.validate(gc);
|
||||
Graphics2D g2d = vi.createGraphics();
|
||||
g2d.setColor(Color.green);
|
||||
g2d.fillRect(0, 0, width / 4, height / 4);
|
||||
g2d.dispose();
|
||||
|
||||
if (vi.validate(gc) != VolatileImage.IMAGE_OK) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Graphics2D g = bi.createGraphics();
|
||||
g.setComposite(AlphaComposite.Src);
|
||||
g.setColor(Color.red);
|
||||
g.fillRect(0, 0, width, height);
|
||||
// Use sx and sy outside of VI bounds.
|
||||
g.drawImage(vi, 0, 0, width / 2, height / 2, 0, 0, width * 2,
|
||||
height * 2, null);
|
||||
g.dispose();
|
||||
|
||||
if (vi.contentsLost()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int x = 0; x < width; ++x) {
|
||||
for (int y = 0; y < height; ++y) {
|
||||
if (x < width / 16 && y < height / 16) {
|
||||
if (bi.getRGB(x, y) != Color.green.getRGB()) {
|
||||
throw new RuntimeException("Test failed.");
|
||||
}
|
||||
} else {
|
||||
if (bi.getRGB(x, y) != Color.red.getRGB()) {
|
||||
throw new RuntimeException("Test failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
93
jdk/test/java/awt/image/DrawImage/IncorrectOffset.java
Normal file
93
jdk/test/java/awt/image/DrawImage/IncorrectOffset.java
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.VolatileImage;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8000629
|
||||
* @summary Temporary backbuffer in the DrawImage should have correct offset.
|
||||
* @author Sergey Bylokhov
|
||||
*/
|
||||
public final class IncorrectOffset {
|
||||
|
||||
private static final int width = 400;
|
||||
private static final int height = 400;
|
||||
|
||||
public static void main(final String[] args) {
|
||||
GraphicsEnvironment ge =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
GraphicsConfiguration gc =
|
||||
ge.getDefaultScreenDevice().getDefaultConfiguration();
|
||||
VolatileImage vi = gc.createCompatibleVolatileImage(width, height);
|
||||
BufferedImage bi = new BufferedImage(width / 4, height / 4,
|
||||
BufferedImage.TYPE_INT_ARGB);
|
||||
while (true) {
|
||||
vi.validate(gc);
|
||||
Graphics2D g2d = vi.createGraphics();
|
||||
g2d.setColor(Color.black);
|
||||
g2d.fillRect(0, 0, width, height);
|
||||
g2d.setColor(Color.green);
|
||||
g2d.fillRect(width / 4, height / 4, width / 2, height / 2);
|
||||
g2d.dispose();
|
||||
|
||||
if (vi.validate(gc) != VolatileImage.IMAGE_OK) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Graphics2D g = bi.createGraphics();
|
||||
g.setComposite(AlphaComposite.Src);
|
||||
// Scale part of VI to BI. Only green area should be copied.
|
||||
g.drawImage(vi, 0, 0, width / 4, height / 4, width / 4, height / 4,
|
||||
width / 4 + width / 2, height / 4 + height / 2, null);
|
||||
g.dispose();
|
||||
|
||||
if (vi.contentsLost()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int x = 0; x < width / 4; ++x) {
|
||||
for (int y = 0; y < height / 4; ++y) {
|
||||
if (bi.getRGB(x, y) != Color.green.getRGB()) {
|
||||
throw new RuntimeException("Test failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
jdk/test/java/beans/Introspector/Test4683761.java
Normal file
45
jdk/test/java/beans/Introspector/Test4683761.java
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 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 4683761
|
||||
* @summary Tests that all public methods in a public class
|
||||
* @author Sergey Malenkov
|
||||
*/
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Test4683761 {
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.setSecurityManager(new SecurityManager());
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("key", "value");
|
||||
Map.Entry<String, String> entry = map.entrySet().iterator().next();
|
||||
for (PropertyDescriptor pd : BeanUtils.getPropertyDescriptors(entry.getClass())) {
|
||||
System.out.println(pd.getName() + " = " + pd.getReadMethod().invoke(entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user