提交 e3118301 编写于 作者: P pchelko

8029868: Fix KSS issues in sun.lwawt.macosx

Reviewed-by: anthony, serb
上级 054e8f42
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
......@@ -40,20 +40,23 @@ import sun.awt.datatransfer.*;
* sun.awt.datatransfer.DataTransferer.
*/
public class CClipboard extends SunClipboard {
final class CClipboard extends SunClipboard {
public CClipboard(String name) {
super(name);
}
@Override
public long getID() {
return 0;
}
@Override
protected void clearNativeContext() {
// Leaving Empty, as WClipboard.clearNativeContext is empty as well.
}
@Override
protected void setContentsNative(Transferable contents) {
// Don't use delayed Clipboard rendering for the Transferable's data.
......@@ -89,27 +92,19 @@ public class CClipboard extends SunClipboard {
notifyChanged();
}
private void notifyLostOwnership() {
lostOwnershipImpl();
}
private static void notifyChanged() {
CClipboard clipboard = (CClipboard) Toolkit.getDefaultToolkit().getSystemClipboard();
if (!clipboard.areFlavorListenersRegistered()) {
return;
}
clipboard.checkChange(clipboard.getClipboardFormats());
}
@Override
protected native long[] getClipboardFormats();
@Override
protected native byte[] getClipboardData(long format) throws IOException;
// 1.5 peer method
@Override
protected void unregisterClipboardViewerChecked() {
// no-op because we lack OS support. This requires 4048791, which requires 4048792
}
// 1.5 peer method
@Override
protected void registerClipboardViewerChecked() {
// no-op because we lack OS support. This requires 4048791, which requires 4048792
}
......@@ -118,8 +113,8 @@ public class CClipboard extends SunClipboard {
// no-op. This appears to be win32 specific. Filed 4048790 for investigation
//protected Transferable createLocaleTransferable(long[] formats) throws IOException;
public native void declareTypes(long[] formats, SunClipboard newOwner);
public native void setData(byte[] data, long format);
private native void declareTypes(long[] formats, SunClipboard newOwner);
private native void setData(byte[] data, long format);
/**
* Invokes native check whether a change count on the general pasteboard is different
......@@ -127,5 +122,18 @@ public class CClipboard extends SunClipboard {
* pasteboard ownership and someone else put data on the clipboard.
* @since 1.7
*/
public native void checkPasteboard();
native void checkPasteboard();
/*** Native Callbacks ***/
private void notifyLostOwnership() {
lostOwnershipImpl();
}
private static void notifyChanged() {
CClipboard clipboard = (CClipboard) Toolkit.getDefaultToolkit().getSystemClipboard();
if (!clipboard.areFlavorListenersRegistered()) {
return;
}
clipboard.checkChange(clipboard.getClipboardFormats());
}
}
......@@ -28,7 +28,6 @@ package sun.lwawt.macosx;
import sun.lwawt.LWToolkit;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.macosx.CocoaConstants;
import sun.lwawt.macosx.event.NSEvent;
import sun.awt.EmbeddedFrame;
......
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
......@@ -28,7 +28,7 @@ package sun.lwawt.macosx;
import sun.awt.SunToolkit;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.PlatformEventNotifier;
import sun.lwawt.macosx.event.NSEvent;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.awt.event.InputEvent;
......
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
......@@ -31,7 +31,6 @@ import java.awt.geom.Rectangle2D;
import sun.awt.CGraphicsConfig;
import sun.awt.CGraphicsEnvironment;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.macosx.event.NSEvent;
import sun.java2d.SurfaceData;
import sun.java2d.opengl.CGLLayer;
......
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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,7 +41,7 @@ import javax.print.attribute.standard.PageRanges;
import sun.java2d.*;
import sun.print.*;
public class CPrinterJob extends RasterPrinterJob {
final class CPrinterJob extends RasterPrinterJob {
// NOTE: This uses RasterPrinterJob as a base, but it doesn't use
// all of the RasterPrinterJob functions. RasterPrinterJob will
// break down printing to pieces that aren't necessary under MacOSX
......@@ -89,6 +89,7 @@ public class CPrinterJob extends RasterPrinterJob {
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
*/
@Override
public boolean printDialog() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
......@@ -131,6 +132,7 @@ public class CPrinterJob extends RasterPrinterJob {
* @see java.awt.GraphicsEnvironment#isHeadless
* @since 1.2
*/
@Override
public PageFormat pageDialog(PageFormat page) throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
......@@ -156,12 +158,14 @@ public class CPrinterJob extends RasterPrinterJob {
* @return clone of <code>page</code>, altered to describe a default
* <code>PageFormat</code>.
*/
@Override
public PageFormat defaultPage(PageFormat page) {
PageFormat newPage = (PageFormat)page.clone();
getDefaultPage(newPage);
return newPage;
}
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
super.setAttributes(attributes);
......@@ -216,7 +220,7 @@ public class CPrinterJob extends RasterPrinterJob {
}
}
@Override
public void print(PrintRequestAttributeSet attributes) throws PrinterException {
// NOTE: Some of this code is copied from RasterPrinterJob.
......@@ -343,6 +347,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Returns the resolution in dots per inch across the width
* of the page.
*/
@Override
protected double getXRes() {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
......@@ -352,6 +357,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Returns the resolution in dots per inch down the height
* of the page.
*/
@Override
protected double getYRes() {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
......@@ -362,6 +368,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPrintableX(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
......@@ -372,6 +379,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPrintableY(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
......@@ -382,6 +390,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPrintableWidth(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
......@@ -392,6 +401,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPrintableHeight(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
......@@ -402,6 +412,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPageWidth(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
......@@ -412,6 +423,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPageHeight(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
......@@ -429,6 +441,7 @@ public class CPrinterJob extends RasterPrinterJob {
/**
* End a page.
*/
@Override
protected void endPage(PageFormat format, Printable painter, int index) throws PrinterException {
// NOTE: This is not used in the CPrinterJob code path.
throw new PrinterException(sShouldNotReachHere);
......@@ -441,6 +454,7 @@ public class CPrinterJob extends RasterPrinterJob {
* page. The width and height of the band is
* specified by the caller.
*/
@Override
protected void printBand(byte[] data, int x, int y, int width, int height) throws PrinterException {
// NOTE: This is not used in the CPrinterJob code path.
throw new PrinterException(sShouldNotReachHere);
......@@ -450,6 +464,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Called by the print() method at the start of
* a print job.
*/
@Override
protected void startDoc() throws PrinterException {
// NOTE: This is not used in the CPrinterJob code path.
throw new PrinterException(sShouldNotReachHere);
......@@ -459,12 +474,14 @@ public class CPrinterJob extends RasterPrinterJob {
* Called by the print() method at the end of
* a print job.
*/
@Override
protected void endDoc() throws PrinterException {
// NOTE: This is not used in the CPrinterJob code path.
throw new PrinterException(sShouldNotReachHere);
}
/* Called by cancelDoc */
@Override
protected native void abortDoc();
/**
......@@ -502,10 +519,12 @@ public class CPrinterJob extends RasterPrinterJob {
/**
* validate the paper size against the current printer.
*/
@Override
protected native void validatePaper(Paper origPaper, Paper newPaper );
// The following methods are CPrinterJob specific.
@Override
protected void finalize() {
if (fNSPrintInfo != -1) {
dispose(fNSPrintInfo);
......
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
......@@ -29,7 +29,7 @@ package sun.lwawt.macosx;
import java.awt.*;
import java.awt.print.*;
public class CPrinterJobDialog extends CPrinterDialog {
final class CPrinterJobDialog extends CPrinterDialog {
private Pageable fPageable;
private boolean fAllowPrintToFile;
......@@ -39,5 +39,6 @@ public class CPrinterJobDialog extends CPrinterDialog {
fAllowPrintToFile = allowPrintToFile;
}
@Override
protected native boolean showDialog();
}
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
......@@ -29,7 +29,7 @@ package sun.lwawt.macosx;
import java.awt.*;
import java.awt.print.*;
public class CPrinterPageDialog extends CPrinterDialog {
final class CPrinterPageDialog extends CPrinterDialog {
private PageFormat fPage;
private Printable fPainter;
......@@ -39,5 +39,6 @@ public class CPrinterPageDialog extends CPrinterDialog {
fPainter = painter;
}
@Override
protected native boolean showDialog();
}
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
......@@ -40,11 +40,11 @@ public class CPrinterSurfaceData extends OSXSurfaceData{
// public static final SurfaceType IntArgbPQ = SurfaceType.IntArgb.deriveSubType(DESC_INT_ARGB_PQ);
public static final SurfaceType IntRgbPQ = SurfaceType.IntRgb.deriveSubType(DESC_INT_RGB_PQ);
public static SurfaceData createData(PageFormat pf, long context) {
static SurfaceData createData(PageFormat pf, long context) {
return new CPrinterSurfaceData(CPrinterGraphicsConfig.getConfig(pf), context);
}
public CPrinterSurfaceData(GraphicsConfiguration gc, long context) {
private CPrinterSurfaceData(GraphicsConfiguration gc, long context) {
super(IntRgbPQ, gc.getColorModel(), gc, gc.getBounds());
initOps(context, this.fGraphicsStates, this.fGraphicsStatesObject, gc.getBounds().width, gc.getBounds().height);
}
......
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
......@@ -27,7 +27,6 @@ package sun.lwawt.macosx;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.lwawt.macosx.event.NSEvent;
import javax.swing.*;
import java.awt.*;
......
......@@ -25,65 +25,65 @@
package sun.lwawt.macosx;
public final class CWrapper {
final class CWrapper {
private CWrapper() { }
public static final class NSWindow {
static final class NSWindow {
// NSWindowOrderingMode
public static final int NSWindowAbove = 1;
public static final int NSWindowBelow = -1;
public static final int NSWindowOut = 0;
static final int NSWindowAbove = 1;
static final int NSWindowBelow = -1;
static final int NSWindowOut = 0;
// Window level constants
// The number of supported levels: (we'll use more in the future)
public static final int MAX_WINDOW_LEVELS = 3;
static final int MAX_WINDOW_LEVELS = 3;
// The levels: (these are NOT real constants, these are keys. See native code.)
public static final int NSNormalWindowLevel = 0;
public static final int NSFloatingWindowLevel = 1;
public static final int NSPopUpMenuWindowLevel = 2;
static final int NSNormalWindowLevel = 0;
static final int NSFloatingWindowLevel = 1;
static final int NSPopUpMenuWindowLevel = 2;
// 'level' is one of the keys defined above
public static native void setLevel(long window, int level);
static native void setLevel(long window, int level);
public static native void makeKeyAndOrderFront(long window);
public static native void makeKeyWindow(long window);
public static native void makeMainWindow(long window);
public static native boolean canBecomeMainWindow(long window);
public static native boolean isKeyWindow(long window);
static native void makeKeyAndOrderFront(long window);
static native void makeKeyWindow(long window);
static native void makeMainWindow(long window);
static native boolean canBecomeMainWindow(long window);
static native boolean isKeyWindow(long window);
public static native void orderFront(long window);
public static native void orderFrontRegardless(long window);
public static native void orderWindow(long window, int ordered, long relativeTo);
public static native void orderOut(long window);
static native void orderFront(long window);
static native void orderFrontRegardless(long window);
static native void orderWindow(long window, int ordered, long relativeTo);
static native void orderOut(long window);
public static native void addChildWindow(long parent, long child, int ordered);
public static native void removeChildWindow(long parent, long child);
static native void addChildWindow(long parent, long child, int ordered);
static native void removeChildWindow(long parent, long child);
public static native void setAlphaValue(long window, float alpha);
public static native void setOpaque(long window, boolean opaque);
public static native void setBackgroundColor(long window, long color);
static native void setAlphaValue(long window, float alpha);
static native void setOpaque(long window, boolean opaque);
static native void setBackgroundColor(long window, long color);
public static native void miniaturize(long window);
public static native void deminiaturize(long window);
public static native boolean isZoomed(long window);
public static native void zoom(long window);
static native void miniaturize(long window);
static native void deminiaturize(long window);
static native boolean isZoomed(long window);
static native void zoom(long window);
public static native void makeFirstResponder(long window, long responder);
static native void makeFirstResponder(long window, long responder);
}
public static final class NSView {
public static native void addSubview(long view, long subview);
public static native void removeFromSuperview(long view);
static final class NSView {
static native void addSubview(long view, long subview);
static native void removeFromSuperview(long view);
public static native void setFrame(long view, int x, int y, int w, int h);
public static native long window(long view);
static native void setFrame(long view, int x, int y, int w, int h);
static native long window(long view);
public static native void setHidden(long view, boolean hidden);
static native void setHidden(long view, boolean hidden);
public static native void setToolTip(long view, String msg);
static native void setToolTip(long view, String msg);
}
public static final class NSColor {
public static native long clearColor();
static final class NSColor {
static native long clearColor();
}
}
......@@ -158,25 +158,14 @@ public final class LWCToolkit extends LWToolkit {
return new AppleSpecificColor(color);
}
// This is only called from native code.
static void systemColorsChanged() {
// This is only called from native code.
EventQueue.invokeLater(new Runnable() {
public void run() {
AccessController.doPrivileged (new PrivilegedAction<Object>() {
public Object run() {
try {
final Method updateColorsMethod = SystemColor.class.getDeclaredMethod("updateSystemColors", new Class[0]);
updateColorsMethod.setAccessible(true);
updateColorsMethod.invoke(null, new Object[0]);
} catch (final Throwable e) {
e.printStackTrace();
// swallow this if something goes horribly wrong
}
return null;
}
});
}
});
EventQueue.invokeLater(() -> {
AccessController.doPrivileged ((PrivilegedAction<Object>) () -> {
AWTAccessor.getSystemColorAccessor().updateSystemColors();
return null;
});
});
}
public static LWCToolkit getLWCToolkit() {
......@@ -736,7 +725,7 @@ public final class LWCToolkit extends LWToolkit {
/*
* Returns true if the application (one of its windows) owns keyboard focus.
*/
public native boolean isApplicationActive();
native boolean isApplicationActive();
/************************
* Native methods section
......
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
......@@ -23,16 +23,15 @@
* questions.
*/
package sun.lwawt.macosx.event;
package sun.lwawt.macosx;
import sun.lwawt.macosx.CocoaConstants;
import java.awt.event.*;
/**
* A class representing Cocoa NSEvent class with the fields only necessary for
* JDK functionality.
*/
public final class NSEvent {
final class NSEvent {
private int type;
private int modifierFlags;
......@@ -50,14 +49,16 @@ public final class NSEvent {
private short keyCode;
private String charactersIgnoringModifiers;
public NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
// Called from native
NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
this.type = type;
this.modifierFlags = modifierFlags;
this.keyCode = keyCode;
this.charactersIgnoringModifiers = charactersIgnoringModifiers;
}
public NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
// Called from native
NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
int x, int y, int absX, int absY,
double scrollDeltaY, double scrollDeltaX) {
this.type = type;
......@@ -72,51 +73,51 @@ public final class NSEvent {
this.scrollDeltaX = scrollDeltaX;
}
public int getType() {
int getType() {
return type;
}
public int getModifierFlags() {
int getModifierFlags() {
return modifierFlags;
}
public int getClickCount() {
int getClickCount() {
return clickCount;
}
public int getButtonNumber() {
int getButtonNumber() {
return buttonNumber;
}
public int getX() {
int getX() {
return x;
}
public int getY() {
int getY() {
return y;
}
public double getScrollDeltaY() {
double getScrollDeltaY() {
return scrollDeltaY;
}
public double getScrollDeltaX() {
double getScrollDeltaX() {
return scrollDeltaX;
}
public int getAbsX() {
int getAbsX() {
return absX;
}
public int getAbsY() {
int getAbsY() {
return absY;
}
public short getKeyCode() {
short getKeyCode() {
return keyCode;
}
public String getCharactersIgnoringModifiers() {
String getCharactersIgnoringModifiers() {
return charactersIgnoringModifiers;
}
......@@ -131,7 +132,7 @@ public final class NSEvent {
/*
* Converts an NSEvent button number to a MouseEvent constant.
*/
public static int nsToJavaButton(int buttonNumber) {
static int nsToJavaButton(int buttonNumber) {
int jbuttonNumber = buttonNumber + 1;
switch (buttonNumber) {
case CocoaConstants.kCGMouseButtonLeft:
......@@ -150,7 +151,7 @@ public final class NSEvent {
/*
* Converts NPCocoaEvent types to AWT event types.
*/
public static int npToJavaEventType(int npEventType) {
static int npToJavaEventType(int npEventType) {
int jeventType = 0;
switch (npEventType) {
case CocoaConstants.NPCocoaEventMouseDown:
......@@ -184,7 +185,7 @@ public final class NSEvent {
/*
* Converts NSEvent types to AWT event types.
*/
public static int nsToJavaEventType(int nsEventType) {
static int nsToJavaEventType(int nsEventType) {
int jeventType = 0;
switch (nsEventType) {
case CocoaConstants.NSLeftMouseDown:
......@@ -227,31 +228,31 @@ public final class NSEvent {
/*
* Converts NSEvent mouse modifiers to AWT mouse modifiers.
*/
public static native int nsToJavaMouseModifiers(int buttonNumber,
static native int nsToJavaMouseModifiers(int buttonNumber,
int modifierFlags);
/*
* Converts NSEvent key modifiers to AWT key modifiers.
*/
public static native int nsToJavaKeyModifiers(int modifierFlags);
static native int nsToJavaKeyModifiers(int modifierFlags);
/*
* Converts NSEvent key info to AWT key info.
*/
public static native boolean nsToJavaKeyInfo(int[] in, int[] out);
static native boolean nsToJavaKeyInfo(int[] in, int[] out);
/*
* Converts NSEvent key modifiers to AWT key info.
*/
public static native void nsKeyModifiersToJavaKeyInfo(int[] in, int[] out);
static native void nsKeyModifiersToJavaKeyInfo(int[] in, int[] out);
/*
* There is a small number of NS characters that need to be converted
* into other characters before we pass them to AWT.
*/
public static native char nsToJavaChar(char nsChar, int modifierFlags);
static native char nsToJavaChar(char nsChar, int modifierFlags);
public static boolean isPopupTrigger(int jmodifiers) {
static boolean isPopupTrigger(int jmodifiers) {
final boolean isRightButtonDown = ((jmodifiers & InputEvent.BUTTON3_DOWN_MASK) != 0);
final boolean isLeftButtonDown = ((jmodifiers & InputEvent.BUTTON1_DOWN_MASK) != 0);
final boolean isControlDown = ((jmodifiers & InputEvent.CTRL_DOWN_MASK) != 0);
......
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
......@@ -633,12 +633,12 @@ Java_java_awt_AWTEvent_nativeSetSource
}
/*
* Class: sun_lwawt_macosx_event_NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsToJavaMouseModifiers
* Signature: (II)I
*/
JNIEXPORT jint JNICALL
Java_sun_lwawt_macosx_event_NSEvent_nsToJavaMouseModifiers
Java_sun_lwawt_macosx_NSEvent_nsToJavaMouseModifiers
(JNIEnv *env, jclass cls, jint buttonNumber, jint modifierFlags)
{
jint jmodifiers = 0;
......@@ -653,12 +653,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_event_NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsToJavaKeyModifiers
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_sun_lwawt_macosx_event_NSEvent_nsToJavaKeyModifiers
Java_sun_lwawt_macosx_NSEvent_nsToJavaKeyModifiers
(JNIEnv *env, jclass cls, jint modifierFlags)
{
jint jmodifiers = 0;
......@@ -673,12 +673,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_event_NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsToJavaKeyInfo
* Signature: ([I[I)Z
*/
JNIEXPORT jboolean JNICALL
Java_sun_lwawt_macosx_event_NSEvent_nsToJavaKeyInfo
Java_sun_lwawt_macosx_NSEvent_nsToJavaKeyInfo
(JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
{
BOOL postsTyped = NO;
......@@ -715,12 +715,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_event_NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsKeyModifiersToJavaKeyInfo
* Signature: ([I[I)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_event_NSEvent_nsKeyModifiersToJavaKeyInfo
Java_sun_lwawt_macosx_NSEvent_nsKeyModifiersToJavaKeyInfo
(JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
{
JNF_COCOA_ENTER(env);
......@@ -753,12 +753,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_event_NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsToJavaChar
* Signature: (CI)C
*/
JNIEXPORT jint JNICALL
Java_sun_lwawt_macosx_event_NSEvent_nsToJavaChar
Java_sun_lwawt_macosx_NSEvent_nsToJavaChar
(JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags)
{
jchar javaChar = 0;
......
......@@ -380,7 +380,7 @@ AWT_ASSERT_APPKIT_THREAD;
clickCount = [event clickCount];
}
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
jobject jEvent = JNFNewObject(env, jctor_NSEvent,
[event type],
......@@ -397,7 +397,7 @@ AWT_ASSERT_APPKIT_THREAD;
}
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
JNFCallVoidMethod(env, m_cPlatformView, jm_deliverMouseEvent, jEvent);
}
......@@ -445,7 +445,7 @@ AWT_ASSERT_APPKIT_THREAD;
characters = JNFNSToJavaString(env, [event characters]);
}
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;)V");
jobject jevent = JNFNewObject(env, jctor_NSEvent,
[event type],
......@@ -455,7 +455,7 @@ AWT_ASSERT_APPKIT_THREAD;
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
"deliverKeyEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
"deliverKeyEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent);
if (characters != NULL) {
......
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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
......@@ -135,7 +135,7 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
clickCount = [event clickCount];
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
jobject jEvent = JNFNewObject(env, jctor_NSEvent,
[event type],
......@@ -152,7 +152,7 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
}
static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon");
static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent);
}
......
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, 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
......@@ -24,6 +24,8 @@
*/
package java.awt;
import sun.awt.AWTAccessor;
import java.io.ObjectStreamException;
import java.lang.annotation.Native;
......@@ -459,7 +461,8 @@ public final class SystemColor extends Color implements java.io.Serializable {
};
static {
updateSystemColors();
AWTAccessor.setSystemColorAccessor(SystemColor::updateSystemColors);
updateSystemColors();
}
/**
......
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2014, 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
......@@ -728,6 +728,13 @@ public final class AWTAccessor {
void dispose(InvocationEvent event);
}
/*
* An accessor object for the SystemColor class
*/
public interface SystemColorAccessor {
void updateSystemColors();
}
/*
* Accessor instances are initialized in the static initializers of
* corresponding AWT classes by using setters defined below.
......@@ -757,6 +764,7 @@ public final class AWTAccessor {
private static SequencedEventAccessor sequencedEventAccessor;
private static ToolkitAccessor toolkitAccessor;
private static InvocationEventAccessor invocationEventAccessor;
private static SystemColorAccessor systemColorAccessor;
/*
* Set an accessor object for the java.awt.Component class.
......@@ -1182,4 +1190,22 @@ public final class AWTAccessor {
public static InvocationEventAccessor getInvocationEventAccessor() {
return invocationEventAccessor;
}
/*
* Get the accessor object for the java.awt.SystemColor class.
*/
public static SystemColorAccessor getSystemColorAccessor() {
if (systemColorAccessor == null) {
unsafe.ensureClassInitialized(SystemColor.class);
}
return systemColorAccessor;
}
/*
* Set the accessor object for the java.awt.SystemColor class.
*/
public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) {
AWTAccessor.systemColorAccessor = systemColorAccessor;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册