Mercurial > hg > release > icedtea7-forest-2.2 > jdk
changeset 5312:0b05585db1c8
8001308: Update display of applet windows
Summary: Implemented security warning for OS X port
Reviewed-by: art, anthony, serb, skoivu
line wrap: on
line diff
--- a/make/sun/awt/Makefile Wed Jun 12 11:01:08 2013 +0100 +++ b/make/sun/awt/Makefile Wed Jun 12 11:21:44 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -38,6 +38,10 @@ OTHER_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES +ifneq ($(PLATFORM), windows) +CLASSES_INIT += $(TEMPDIR)/.gen_icons +endif + # # Files # @@ -208,6 +212,79 @@ endif build: fontconfigs +ifneq ($(PLATFORM), windows) + +GEN_DIR=$(GENSRCDIR)/sun/awt/ + +ifdef OPENJDK + ICONS_PATH_PREFIX=$(PLATFORM_SRC) +else + ICONS_PATH_PREFIX=$(CLOSED_SRC)/solaris +endif + +ICONS = \ + $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \ + $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \ + $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \ + $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png + +ICONPATH=$(SHARE_SRC)/classes/sun/awt/resources + +ICONS += \ + $(ICONPATH)/security-icon-bw16.png \ + $(ICONPATH)/security-icon-interim16.png \ + $(ICONPATH)/security-icon-yellow16.png \ + $(ICONPATH)/security-icon-bw24.png \ + $(ICONPATH)/security-icon-interim24.png \ + $(ICONPATH)/security-icon-yellow24.png \ + $(ICONPATH)/security-icon-bw32.png \ + $(ICONPATH)/security-icon-interim32.png \ + $(ICONPATH)/security-icon-yellow32.png \ + $(ICONPATH)/security-icon-bw48.png \ + $(ICONPATH)/security-icon-interim48.png \ + $(ICONPATH)/security-icon-yellow48.png + +TEMPDIR_CLASSES = $(TEMPDIR)/classes + +generated.clean: + $(RM) -r $(GEN_DIR)/*.java + $(RM) -r $(TEMPDIR)/.gen_icons + +$(TEMPDIR_CLASSES)/sun/awt/ToBin.class: ToBin.java + @$(prep-target) + $(BOOT_JAVAC_CMD) -d $(TEMPDIR_CLASSES) $< + +$(TEMPDIR)/.gen_icons: $(TEMPDIR_CLASSES)/sun/awt/ToBin.class $(ICONS) + $(prep-target) + for i in $(ICONS); do \ + filename=`basename $$i`; \ + name=`$(ECHO) $$filename | $(TR) '\-.' '__'`; \ + classname=$(GEN_DIR)/AWTIcon32_$$name.java; \ + $(RM) $$classname; \ + $(ECHO) "package sun.awt;" >> $$classname ; \ + $(ECHO) "public class AWTIcon32_$$name {" >> $$classname; \ + $(ECHO) "public final static int[] $$name = { " >> $$classname; \ + $(CAT) $$i | \ + $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES) \ + -Djava.awt.headless=true \ + sun.awt.ToBin >> $$classname; \ + $(ECHO) "}; }" >> $$classname; \ + classname=$(GEN_DIR)/AWTIcon64_$$name.java; \ + $(RM) $$classname; \ + $(ECHO) "package sun.awt;" >> $$classname ; \ + $(ECHO) "public class AWTIcon64_$$name {" >> $$classname; \ + $(ECHO) "public final static long[] $$name = { " >> $$classname; \ + $(CAT) $$i | \ + $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES) \ + -Djava.awt.headless=true \ + sun.awt.ToBin >> $$classname; \ + $(ECHO) "}; }" >> $$classname; \ + done + $(TOUCH) $@ + +clean clobber:: generated.clean +endif + ifeq ($(PLATFORM), windows) # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv WINDOWS @@ -565,5 +642,5 @@ java.lang.Integer \ java.lang.ThreadGroup -.PHONY: dgalibs dgalib.clean fontconfigs fontconfigs.clean +.PHONY: dgalibs dgalib.clean fontconfigs fontconfigs.clean generated.clean
--- a/make/sun/xawt/Makefile Wed Jun 12 11:01:08 2013 +0100 +++ b/make/sun/xawt/Makefile Wed Jun 12 11:21:44 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ GEN_DIR=$(GENSRCDIR)/sun/awt/X11 -CLASSES_INIT += $(TEMPDIR)/.gen.wrappers $(TEMPDIR)/.gen_icons touch.wrappers +CLASSES_INIT += $(TEMPDIR)/.gen.wrappers touch.wrappers .PHONY: generated.clean @@ -375,70 +375,7 @@ $(RM) -r $(WRAPPER_GENERATOR_TEMPDIR) $(RM) -r $(WRAPPER_GENERATOR_DIR) $(RM) -r $(GEN_DIR)/*.java - $(RM) -r $(TEMPDIR)/.gen_icons -ifdef OPENJDK - ICONS_PATH_PREFIX=$(PLATFORM_SRC) -else - ICONS_PATH_PREFIX=$(CLOSED_SRC)/solaris -endif - -ICONS = \ - $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \ - $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \ - $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \ - $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png - - -ICONPATH=$(PLATFORM_SRC)/classes/sun/awt/X11 - -ICONS += \ - $(ICONPATH)/security-icon-bw16.png \ - $(ICONPATH)/security-icon-interim16.png \ - $(ICONPATH)/security-icon-yellow16.png \ - $(ICONPATH)/security-icon-bw24.png \ - $(ICONPATH)/security-icon-interim24.png \ - $(ICONPATH)/security-icon-yellow24.png \ - $(ICONPATH)/security-icon-bw32.png \ - $(ICONPATH)/security-icon-interim32.png \ - $(ICONPATH)/security-icon-yellow32.png \ - $(ICONPATH)/security-icon-bw48.png \ - $(ICONPATH)/security-icon-interim48.png \ - $(ICONPATH)/security-icon-yellow48.png - -TEMPDIR_CLASSES = $(TEMPDIR)/classes - -$(TEMPDIR_CLASSES)/sun/awt/X11/ToBin.class: ToBin.java - @$(prep-target) - $(BOOT_JAVAC_CMD) -d $(TEMPDIR_CLASSES) $< - -$(TEMPDIR)/.gen_icons: $(TEMPDIR_CLASSES)/sun/awt/X11/ToBin.class $(ICONS) - $(prep-target) - for i in $(ICONS); do \ - filename=`basename $$i`; \ - name=`$(ECHO) $$filename | $(TR) '\-.' '__'`; \ - classname=$(GEN_DIR)/XAWTIcon32_$$name.java; \ - $(RM) $$classname; \ - $(ECHO) "package sun.awt.X11;" >> $$classname ; \ - $(ECHO) "public class XAWTIcon32_$$name {" >> $$classname; \ - $(ECHO) "public static int[] $$name = { " >> $$classname; \ - $(CAT) $$i | \ - $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES) \ - -Djava.awt.headless=true \ - sun.awt.X11.ToBin >> $$classname; \ - $(ECHO) "}; }" >> $$classname; \ - classname=$(GEN_DIR)/XAWTIcon64_$$name.java; \ - $(RM) $$classname; \ - $(ECHO) "package sun.awt.X11;" >> $$classname ; \ - $(ECHO) "public class XAWTIcon64_$$name {" >> $$classname; \ - $(ECHO) "public static long[] $$name = { " >> $$classname; \ - $(CAT) $$i | \ - $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES) \ - -Djava.awt.headless=true \ - sun.awt.X11.ToBin >> $$classname; \ - $(ECHO) "}; }" >> $$classname; \ - done - $(TOUCH) $@ clean clobber:: generated.clean
--- a/make/sun/xawt/ToBin.java Wed Jun 12 11:01:08 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.awt.X11; - -import java.io.*; -import java.awt.image.*; -import javax.imageio.*; -import java.awt.*; - -public class ToBin { - public static void main(String[] args) throws Exception { - BufferedImage im = ImageIO.read(System.in); - BufferedImage bi = null; - int iconWidth = im.getWidth(null); - int iconHeight = im.getHeight(null); - if (im != null && iconHeight != 0 && iconWidth != 0) { - bi = new BufferedImage(iconWidth, iconHeight, BufferedImage.TYPE_INT_ARGB); - Graphics g = bi.getGraphics(); - try { - g.drawImage(im, 0, 0, iconWidth, iconHeight, null); - } finally { - g.dispose(); - } - } - DataBuffer srcBuf = bi.getData().getDataBuffer(); - int[] buf = ((DataBufferInt)srcBuf).getData(); - System.out.print(iconWidth + ","); - System.out.println(iconHeight + ","); - for (int i = 0; i < buf.length; i++) { - System.out.print("0x" + Integer.toHexString(buf[i]) + ", "); - if (i % 10 == 0) { - System.out.println(); - } - } - } -}
--- a/src/macosx/classes/sun/java2d/opengl/CGLLayer.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/java2d/opengl/CGLLayer.java Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -72,7 +72,7 @@ } public int getTransparency() { - return (peer.isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT); + return (isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT); } public Object getDestination() { @@ -80,14 +80,14 @@ } public SurfaceData replaceSurfaceData() { - if (peer.getBounds().isEmpty()) { + if (getBounds().isEmpty()) { surfaceData = NullSurfaceData.theInstance; return surfaceData; } // the layer redirects all painting to the buffer's graphics // and blits the buffer to the layer surface (in drawInCGLContext callback) - CGraphicsConfig gc = (CGraphicsConfig)peer.getGraphicsConfiguration(); + CGraphicsConfig gc = (CGraphicsConfig)getGraphicsConfiguration(); surfaceData = gc.createSurfaceData(this); // the layer holds a reference to the buffer, which in
--- a/src/macosx/classes/sun/lwawt/LWKeyboardFocusManagerPeer.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/LWKeyboardFocusManagerPeer.java Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -85,9 +85,26 @@ } void setFocusedWindow(LWWindowPeer peer) { + LWWindowPeer from, to; + synchronized (lock) { + if (focusedWindow == peer) { + return; + } + + from = focusedWindow; + to = peer; + focusedWindow = peer; } + + if (from != null) { + from.updateSecurityWarningVisibility(); + } + + if (to != null) { + to.updateSecurityWarningVisibility(); + } } LWWindowPeer getFocusedWindow() {
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/LWToolkit.java Wed Jun 12 11:21:44 2013 +0100 @@ -484,6 +484,8 @@ return clipboard; } + protected abstract SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer); + // ---- DELEGATES ---- // public abstract Clipboard createPlatformClipboard();
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java Wed Jun 12 11:21:44 2013 +0100 @@ -41,7 +41,7 @@ public class LWWindowPeer extends LWContainerPeer<Window, JComponent> - implements WindowPeer, FramePeer, DialogPeer, FullScreenCapable + implements WindowPeer, FramePeer, DialogPeer, FullScreenCapable, PlatformEventNotifier { public static enum PeerType { SIMPLEWINDOW, @@ -109,6 +109,8 @@ private volatile boolean skipNextFocusChange; + private final SecurityWarningWindow warningWindow; + /** * Current modal blocker or null. * @@ -154,6 +156,19 @@ } platformWindow.initialize(target, this, ownerDelegate); + + // Init warning window(for applets) + SecurityWarningWindow warn = null; + if (((Window)target).getWarningString() != null) { + // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip + // and TrayIcon balloon windows without a warning window. + if (!AWTAccessor.getWindowAccessor().isTrayIconWindow((Window)target)) { + LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit(); + warn = toolkit.createSecurityWarning(target, this); + } + } + + warningWindow = warn; } @Override @@ -211,6 +226,10 @@ if (isGrabbing()) { ungrab(); } + if (warningWindow != null) { + warningWindow.dispose(); + } + destroyBuffers(); platformWindow.dispose(); super.disposeImpl(); @@ -218,6 +237,10 @@ @Override protected void setVisibleImpl(final boolean visible) { + if (!visible && warningWindow != null) { + warningWindow.setVisible(false, false); + } + super.setVisibleImpl(visible); // TODO: update graphicsConfig, see 4868278 platformWindow.setVisible(visible); @@ -456,7 +479,15 @@ @Override public void repositionSecurityWarning() { - throw new RuntimeException("not implemented"); + if (warningWindow != null) { + AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); + Window target = getTarget(); + int x = compAccessor.getX(target); + int y = compAccessor.getY(target); + int width = compAccessor.getWidth(target); + int height = compAccessor.getHeight(target); + warningWindow.reposition(x, y, width, height); + } } // ---- FRAME PEER METHODS ---- // @@ -516,6 +547,7 @@ // ---- PEER NOTIFICATIONS ---- // + @Override public void notifyIconify(boolean iconify) { //The toplevel target is Frame and states are applicable to it. //Otherwise, the target is Window and it don't have state property. @@ -540,6 +572,7 @@ } } + @Override public void notifyZoom(boolean isZoomed) { int newWindowState = isZoomed ? Frame.MAXIMIZED_BOTH : Frame.NORMAL; postWindowStateChangedEvent(newWindowState); @@ -548,6 +581,7 @@ /** * Called by the delegate when any part of the window should be repainted. */ + @Override public void notifyExpose(final int x, final int y, final int w, final int h) { // TODO: there's a serious problem with Swing here: it handles // the exposition internally, so SwingPaintEventDispatcher always @@ -566,6 +600,7 @@ * There's no notifyReshape() in LWComponentPeer as the only * components which could be resized by user are top-level windows. */ + @Override public final void notifyReshape(int x, int y, int w, int h) { boolean moved = false; boolean resized = false; @@ -599,6 +634,8 @@ if (resized) { handleResize(w, h,true); } + + repositionSecurityWarning(); } private void clearBackground(final int w, final int h) { @@ -613,15 +650,18 @@ } } + @Override public void notifyUpdateCursor() { getLWToolkit().getCursorManager().updateCursorLater(this); } + @Override public void notifyActivation(boolean activation) { changeFocusedWindow(activation); } // MouseDown in non-client area + @Override public void notifyNCMouseDown() { // Ungrab except for a click on a Dialog with the grabbing owner if (grabbingWindow != null && @@ -638,10 +678,11 @@ * coordinates are relative to non-client window are, i.e. the top-left * point of the client area is (insets.top, insets.left). */ - public void dispatchMouseEvent(int id, long when, int button, - int x, int y, int screenX, int screenY, - int modifiers, int clickCount, boolean popupTrigger, - byte[] bdata) + @Override + public void notifyMouseEvent(int id, long when, int button, + int x, int y, int screenX, int screenY, + int modifiers, int clickCount, boolean popupTrigger, + byte[] bdata) { // TODO: fill "bdata" member of AWTEvent Rectangle r = getBounds(); @@ -660,12 +701,12 @@ if (isEnabled()) { Point lp = lastMouseEventPeer.windowToLocal(x, y, lastWindowPeer); - postEvent(new MouseEvent(lastMouseEventPeer.getTarget(), - MouseEvent.MOUSE_EXITED, when, - modifiers, lp.x, lp.y, screenX, - screenY, clickCount, popupTrigger, - button)); + Component target = lastMouseEventPeer.getTarget(); + postMouseEnteredExitedEvent(target, MouseEvent.MOUSE_EXITED, + when, modifiers, lp, + screenX, screenY, clickCount, popupTrigger, button); } + lastMouseEventPeer = null; } } else { @@ -680,28 +721,25 @@ Rectangle lr = lastWindowPeer.getBounds(); oldp.x += r.x - lr.x; oldp.y += r.y - lr.y; - postEvent(new MouseEvent(lastMouseEventPeer.getTarget(), - MouseEvent.MOUSE_EXITED, - when, modifiers, - oldp.x, oldp.y, screenX, screenY, - clickCount, popupTrigger, button)); + Component target = lastMouseEventPeer.getTarget(); + postMouseEnteredExitedEvent(target, MouseEvent.MOUSE_EXITED, + when, modifiers, oldp, + screenX, screenY, clickCount, popupTrigger, button); } else { Point oldp = lastMouseEventPeer.windowToLocal(x, y, this); - postEvent(new MouseEvent(lastMouseEventPeer.getTarget(), - MouseEvent.MOUSE_EXITED, - when, modifiers, - oldp.x, oldp.y, screenX, screenY, - clickCount, popupTrigger, button)); + Component target = lastMouseEventPeer.getTarget(); + postMouseEnteredExitedEvent(target, MouseEvent.MOUSE_EXITED, + when, modifiers, oldp, + screenX, screenY, clickCount, popupTrigger, button); } } lastMouseEventPeer = targetPeer; if (targetPeer != null && targetPeer.isEnabled() && id != MouseEvent.MOUSE_ENTERED) { Point newp = targetPeer.windowToLocal(x, y, curWindowPeer); - postEvent(new MouseEvent(targetPeer.getTarget(), - MouseEvent.MOUSE_ENTERED, - when, modifiers, - newp.x, newp.y, screenX, screenY, - clickCount, popupTrigger, button)); + Component target = targetPeer.getTarget(); + postMouseEnteredExitedEvent(target, MouseEvent.MOUSE_ENTERED, + when, modifiers, newp, + screenX, screenY, clickCount, popupTrigger, button); } } // TODO: fill "bdata" member of AWTEvent @@ -767,11 +805,17 @@ Point lp = targetPeer.windowToLocal(x, y, curWindowPeer); if (targetPeer.isEnabled()) { - MouseEvent event = new MouseEvent(targetPeer.getTarget(), id, + if (id == MouseEvent.MOUSE_ENTERED || id == MouseEvent.MOUSE_EXITED) { + postMouseEnteredExitedEvent(targetPeer.getTarget(), id, + when, modifiers, lp, screenX, screenY, + clickCount, popupTrigger, button); + } else { + MouseEvent event = new MouseEvent(targetPeer.getTarget(), id, when, modifiers, lp.x, lp.y, screenX, screenY, clickCount, popupTrigger, button); - postEvent(event); + postEvent(event); + } } if (id == MouseEvent.MOUSE_RELEASED) { @@ -790,10 +834,22 @@ } } - public void dispatchMouseWheelEvent(long when, int x, int y, int modifiers, - int scrollType, int scrollAmount, - int wheelRotation, double preciseWheelRotation, - byte[] bdata) + private void postMouseEnteredExitedEvent( + Component target, int id, long when, int modifiers, + Point loc, int xAbs, int yAbs, + int clickCount, boolean popupTrigger, int button) { + + updateSecurityWarningVisibility(); + + postEvent(new MouseEvent(target, id, when, modifiers, loc.x, loc.y, + xAbs, yAbs, clickCount, popupTrigger, button)); + } + + @Override + public void notifyMouseWheelEvent(long when, int x, int y, int modifiers, + int scrollType, int scrollAmount, + int wheelRotation, double preciseWheelRotation, + byte[] bdata) { // TODO: could we just use the last mouse event target here? Rectangle r = getBounds(); @@ -819,8 +875,9 @@ /* * Called by the delegate when a key is pressed. */ - public void dispatchKeyEvent(int id, long when, int modifiers, - int keyCode, char keyChar, int keyLocation) + @Override + public void notifyKeyEvent(int id, long when, int modifiers, + int keyCode, char keyChar, int keyLocation) { LWComponentPeer focusOwner = LWKeyboardFocusManagerPeer.getInstance(getAppContext()). @@ -851,6 +908,8 @@ windowState, newWindowState); postEvent(stateChangedEvent); windowState = newWindowState; + + updateSecurityWarningVisibility(); } private static int getGraphicsConfigScreen(GraphicsConfiguration gc) { @@ -1226,10 +1285,12 @@ public void enterFullScreenMode() { platformWindow.enterFullScreenMode(); + updateSecurityWarningVisibility(); } public void exitFullScreenMode() { platformWindow.exitFullScreenMode(); + updateSecurityWarningVisibility(); } public long getLayerPtr() { @@ -1254,6 +1315,33 @@ return this == grabbingWindow; } + public void updateSecurityWarningVisibility() { + if (warningWindow == null) { + return; + } + + if (!isVisible()) { + return; // The warning window should already be hidden. + } + + boolean show = false; + + if (!platformWindow.isFullScreenMode()) { + if (isVisible()) { + if (LWKeyboardFocusManagerPeer.getInstance(getAppContext()).getCurrentFocusedWindow() == + getTarget()) { + show = true; + } + + if (platformWindow.isUnderMouse() || warningWindow.isUnderMouse()) { + show = true; + } + } + } + + warningWindow.setVisible(show, true); + } + @Override public String toString() { return super.toString() + " [target is " + getTarget() + "]";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/macosx/classes/sun/lwawt/PlatformEventNotifier.java Wed Jun 12 11:21:44 2013 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.lwawt; + +import java.awt.Rectangle; + +public interface PlatformEventNotifier { + void notifyIconify(boolean iconify); + + void notifyZoom(boolean isZoomed); + + void notifyExpose(final int x, final int y, final int w, final int h); + + void notifyReshape(int x, int y, int w, int h); + + void notifyUpdateCursor(); + + void notifyActivation(boolean activation); + + // MouseDown in non-client area + void notifyNCMouseDown(); + + /* + * Called by the delegate to dispatch the event to Java. Event + * coordinates are relative to non-client window are, i.e. the top-left + * point of the client area is (insets.top, insets.left). + */ + void notifyMouseEvent(int id, long when, int button, + int x, int y, int screenX, int screenY, + int modifiers, int clickCount, boolean popupTrigger, + byte[] bdata); + + void notifyMouseWheelEvent(long when, int x, int y, int modifiers, + int scrollType, int scrollAmount, + int wheelRotation, double preciseWheelRotation, + byte[] bdata); + /* + * Called by the delegate when a key is pressed. + */ + void notifyKeyEvent(int id, long when, int modifiers, + int keyCode, char keyChar, int keyLocation); +}
--- a/src/macosx/classes/sun/lwawt/PlatformWindow.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/PlatformWindow.java Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -147,9 +147,13 @@ public void exitFullScreenMode(); + public boolean isFullScreenMode(); + public void setWindowState(int windowState); public long getLayerPtr(); public LWWindowPeer getPeer(); + + public boolean isUnderMouse(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/macosx/classes/sun/lwawt/SecurityWarningWindow.java Wed Jun 12 11:21:44 2013 +0100 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.lwawt; + +public interface SecurityWarningWindow extends PlatformWindow { + /** + * @param x,y,w,h coordinates of the untrusted window + */ + public void reposition(int x, int y, int w, int h); + + public void setVisible(boolean visible, boolean doSchedule); +}
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -185,5 +185,15 @@ public void exitFullScreenMode() {} @Override + public boolean isFullScreenMode() { + return false; + } + + @Override + public boolean isUnderMouse() { + return false; + } + + @Override public void setWindowState(int windowState) {} }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -28,22 +28,25 @@ import sun.awt.SunToolkit; import sun.lwawt.LWWindowPeer; import sun.lwawt.macosx.event.NSEvent; -import java.awt.Toolkit; + +import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.InputEvent; import java.awt.event.MouseWheelEvent; import java.awt.event.KeyEvent; +import sun.lwawt.PlatformEventNotifier; /** * Translates NSEvents/NPCocoaEvents into AWT events. */ final class CPlatformResponder { - private final LWWindowPeer peer; + private final PlatformEventNotifier eventNotifier; private final boolean isNpapiCallback; - CPlatformResponder(final LWWindowPeer peer, final boolean isNpapiCallback) { - this.peer = peer; + CPlatformResponder(final PlatformEventNotifier eventNotifier, + final boolean isNpapiCallback) { + this.eventNotifier = eventNotifier; this.isNpapiCallback = isNpapiCallback; } @@ -77,9 +80,9 @@ modifierFlags); boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers); - peer.dispatchMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber, - x, y, absoluteX, absoluteY, jmodifiers, jclickCount, - jpopupTrigger, null); + eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber, + x, y, absoluteX, absoluteY, jmodifiers, jclickCount, + jpopupTrigger, null); } /** @@ -115,8 +118,8 @@ wheelRotation = signum; } // invert the wheelRotation for the peer - peer.dispatchMouseWheelEvent(when, x, y, modifiers, scrollType, - scrollAmount, -wheelRotation, -delta, null); + eventNotifier.notifyMouseWheelEvent(when, x, y, modifiers, scrollType, + scrollAmount, -wheelRotation, -delta, null); } /** @@ -176,8 +179,8 @@ int jmodifiers = NSEvent.nsToJavaKeyModifiers(modifierFlags); long when = System.currentTimeMillis(); - peer.dispatchKeyEvent(jeventType, when, jmodifiers, - jkeyCode, javaChar, jkeyLocation); + eventNotifier.notifyKeyEvent(jeventType, when, jmodifiers, + jkeyCode, javaChar, jkeyLocation); // That's the reaction on the PRESSED (not RELEASED) event as it comes to // appear in MacOSX. @@ -186,9 +189,9 @@ // for clipboard related shortcuts like Meta + [CVX] boolean isMetaDown = (jmodifiers & KeyEvent.META_DOWN_MASK) != 0; if (jeventType == KeyEvent.KEY_PRESSED && postsTyped && !isMetaDown) { - peer.dispatchKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers, - KeyEvent.VK_UNDEFINED, javaChar, - KeyEvent.KEY_LOCATION_UNKNOWN); + eventNotifier.notifyKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers, + KeyEvent.VK_UNDEFINED, javaChar, + KeyEvent.KEY_LOCATION_UNKNOWN); } } }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -39,6 +39,7 @@ public class CPlatformView extends CFRetainedResource { private native long nativeCreateView(int x, int y, int width, int height, long windowLayerPtr); + private static native boolean nativeIsViewUnderMouse(long ptr); private LWWindowPeer peer; private SurfaceData surfaceData; @@ -54,11 +55,15 @@ this.responder = new CPlatformResponder(peer, false); if (!LWCToolkit.getSunAwtDisableCALayers()) { - this.windowLayer = new CGLLayer(peer); + this.windowLayer = createCGLayer(); } setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr())); } + public CGLLayer createCGLayer() { + return new CGLLayer(peer); + } + public long getAWTView() { return ptr; } @@ -113,6 +118,10 @@ CWrapper.NSView.exitFullScreenMode(ptr); } + public void setToolTip(String msg) { + CWrapper.NSView.setToolTip(ptr, msg); + } + // ---------------------------------------------------------------------- // PAINTING METHODS // ---------------------------------------------------------------------- @@ -127,11 +136,11 @@ } public Image createBackBuffer() { - Rectangle r = peer.getBounds(); + Rectangle r = getBounds(); Image im = null; if (!r.isEmpty()) { int transparency = (isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT); - im = peer.getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency); + im = getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency); } return im; } @@ -141,7 +150,7 @@ surfaceData = windowLayer.replaceSurfaceData(); } else { if (surfaceData == null) { - CGraphicsConfig graphicsConfig = (CGraphicsConfig)peer.getGraphicsConfiguration(); + CGraphicsConfig graphicsConfig = (CGraphicsConfig)getGraphicsConfiguration(); surfaceData = graphicsConfig.createSurfaceData(this); } else { validateSurface(); @@ -180,6 +189,10 @@ } } + public boolean isUnderMouse() { + return nativeIsViewUnderMouse(getAWTView()); + } + // ---------------------------------------------------------------------- // NATIVE CALLBACKS // ---------------------------------------------------------------------- @@ -203,11 +216,11 @@ } private void deliverWindowDidExposeEvent() { - Rectangle r = peer.getBounds(); - peer.notifyExpose(0, 0, r.width, r.height); + Rectangle r = getBounds(); + responder.handleWindowDidExposeEvent(0, 0, r.width, r.height); } private void deliverWindowDidExposeEvent(float x, float y, float w, float h) { - peer.notifyExpose((int)x, (int)y, (int)w, (int)h); + responder.handleWindowDidExposeEvent((int)x, (int)y, (int)w, (int)h); } }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -202,9 +202,9 @@ private Window target; private LWWindowPeer peer; - private CPlatformView contentView; - private CPlatformWindow owner; - private boolean visible = false; // visibility status from native perspective + protected CPlatformView contentView; + protected CPlatformWindow owner; + protected boolean visible = false; // visibility status from native perspective private boolean undecorated; // initialized in getInitialStyleBits() private Rectangle normalBounds = null; // not-null only for undecorated maximized windows @@ -227,11 +227,7 @@ final int styleBits = getInitialStyleBits(); - // TODO: handle these misc properties - final long parentNSWindowPtr = (owner != null ? owner.getNSWindowPtr() : 0); - String warningString = target.getWarningString(); - - contentView = new CPlatformView(); + contentView = createContentView(); contentView.initialize(peer); final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0); @@ -253,6 +249,14 @@ validateSurface(); } + protected CPlatformResponder createPlatformResponder() { + return new CPlatformResponder(peer, false); + } + + protected CPlatformView createContentView() { + return new CPlatformView(); + } + protected int getInitialStyleBits() { // defaults style bits int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE; @@ -456,7 +460,7 @@ nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h); } - private boolean isVisible() { + public boolean isVisible() { return this.visible; } @@ -525,7 +529,7 @@ } // 4. Actually show or hide the window - LWWindowPeer blocker = peer.getBlocker(); + LWWindowPeer blocker = (peer == null)? null : peer.getBlocker(); if (blocker == null || !visible) { // If it ain't blocked, or is being hidden, go regular way if (visible) { @@ -639,6 +643,10 @@ @Override public void setResizable(boolean resizable) { + if (peer == null) { + return; + } + setStyleBits(RESIZABLE, resizable); // Re-apply the size constraints and the size to ensure the space @@ -719,8 +727,13 @@ } @Override + public boolean isFullScreenMode() { + return isFullScreenMode; + } + + @Override public void setWindowState(int windowState) { - if (!peer.isVisible()) { + if (peer == null || !peer.isVisible()) { // setVisible() applies the state return; } @@ -799,6 +812,11 @@ return peer; } + @Override + public boolean isUnderMouse() { + return contentView.isUnderMouse(); + } + public CPlatformView getContentView() { return contentView; } @@ -822,7 +840,7 @@ peer.notifyActivation(gained); } - private void deliverMoveResizeEvent(int x, int y, int width, int height) { + protected void deliverMoveResizeEvent(int x, int y, int width, int height) { // when the content view enters the full-screen mode, the native // move/resize notifications contain a bounds smaller than // the whole screen and therefore we ignore the native notifications @@ -830,27 +848,37 @@ if (isFullScreenMode) return; nativeBounds = new Rectangle(x, y, width, height); - peer.notifyReshape(x, y, width, height); + if (peer != null) { + peer.notifyReshape(x, y, width, height); + } //TODO validateSurface already called from notifyReshape validateSurface(); } private void deliverWindowClosingEvent() { - if (peer.getBlocker() == null) { - peer.postEvent(new WindowEvent(target, WindowEvent.WINDOW_CLOSING)); + if (peer != null) { + if (peer.getBlocker() == null) { + peer.postEvent(new WindowEvent(target, WindowEvent.WINDOW_CLOSING)); + } } } private void deliverIconify(final boolean iconify) { - peer.notifyIconify(iconify); + if (peer != null) { + peer.notifyIconify(iconify); + } } private void deliverZoom(final boolean isZoomed) { - peer.notifyZoom(isZoomed); + if (peer != null) { + peer.notifyZoom(isZoomed); + } } private void deliverNCMouseDown() { - peer.notifyNCMouseDown(); + if (peer != null) { + peer.notifyNCMouseDown(); + } } /* @@ -858,6 +886,10 @@ * may become natively focusable window. */ private boolean isNativelyFocusableWindow() { + if (peer == null) { + return false; + } + return !peer.isSimpleWindow() && target.getFocusableWindowState(); } @@ -872,7 +904,7 @@ } private boolean checkBlocking() { - LWWindowPeer blocker = peer.getBlocker(); + LWWindowPeer blocker = (peer == null)? null : peer.getBlocker(); if (blocker == null) { return false; } @@ -937,8 +969,10 @@ } private void updateWindowContent() { - ComponentEvent resizeEvent = new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED); - SunToolkit.postEvent(SunToolkit.targetToAppContext(target), resizeEvent); + if (target != null) { + ComponentEvent resizeEvent = new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED); + SunToolkit.postEvent(SunToolkit.targetToAppContext(target), resizeEvent); + } } private void windowWillEnterFullScreen() {
--- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -84,6 +84,8 @@ public static native void enterFullScreenMode(long view); public static native void exitFullScreenMode(long view); + + public static native void setToolTip(long view, String msg); } public static final class NSObject {
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Jun 12 11:21:44 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -159,6 +159,11 @@ } @Override + protected SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer) { + return new CWarningWindow(ownerWindow, ownerPeer); + } + + @Override protected PlatformComponent createPlatformComponent() { return new CPlatformComponent(); }
--- a/src/macosx/native/jobjc/src/core/native/SEL.m Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/native/jobjc/src/core/native/SEL.m Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -34,7 +34,7 @@ const char *selNameAsChars = (*env)->GetStringUTFChars(env, selName, JNI_FALSE); const SEL sel = sel_registerName(selNameAsChars); (*env)->ReleaseStringUTFChars(env, selName, selNameAsChars); - return ptr_to_jlong(sel); + return ptr_to_jlong((void*)sel); } JNIEXPORT jstring JNICALL Java_com_apple_jobjc_SEL_getSelectorName
--- a/src/macosx/native/sun/awt/AWTView.m Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/native/sun/awt/AWTView.m Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -1211,3 +1211,29 @@ return ptr_to_jlong(newView); } + +/* + * Class: sun_lwawt_macosx_CPlatformView + * Method: nativeIsViewUnderMouse + * Signature: (J)Z; + */ + +JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CPlatformView_nativeIsViewUnderMouse +(JNIEnv *env, jclass clazz, jlong viewPtr) +{ + __block jboolean underMouse = JNI_FALSE; + +JNF_COCOA_ENTER(env); + + NSView *nsView = OBJC(viewPtr); + [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ + NSPoint ptWindowCoords = [[nsView window] mouseLocationOutsideOfEventStream]; + NSPoint ptViewCoords = [nsView convertPoint:ptWindowCoords fromView:nil]; + underMouse = [nsView hitTest:ptViewCoords] != nil; + }]; + +JNF_COCOA_EXIT(env); + + return underMouse; +} +
--- a/src/macosx/native/sun/awt/AWTWindow.m Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/native/sun/awt/AWTWindow.m Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -723,7 +723,6 @@ (JNIEnv *env, jclass clazz, jlong windowPtr, jdouble originX, jdouble originY, jdouble width, jdouble height) { JNF_COCOA_ENTER(env); -AWT_ASSERT_NOT_APPKIT_THREAD; NSRect jrect = NSMakeRect(originX, originY, width, height);
--- a/src/macosx/native/sun/awt/CWrapper.m Wed Jun 12 11:01:08 2013 +0100 +++ b/src/macosx/native/sun/awt/CWrapper.m Wed Jun 12 11:21:44 2013 +0100 @@ -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 @@ -631,6 +631,27 @@ } /* + * Class: sun_lwawt_macosx_CWrapper$NSView + * Method: setToolTip + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_sun_lwawt_macosx_CWrapper_00024NSView_setToolTip +(JNIEnv *env, jclass cls, jlong viewPtr, jstring msg) +{ + +JNF_COCOA_ENTER(env); + + NSView *view = (NSView *)jlong_to_ptr(viewPtr); + NSString* s = JNFJavaToNSString(env, msg); + [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ + [view setToolTip: s]; + }]; + +JNF_COCOA_EXIT(env); +} + +/* * Class: sun_lwawt_macosx_CWrapper$NSScreen * Method: frame * Signature: (J)Ljava/awt/Rectangle;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/awt/IconInfo.java Wed Jun 12 11:21:44 2013 +0100 @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package sun.awt; +import java.awt.*; +import java.awt.color.*; +import java.awt.image.*; +import sun.awt.image.ToolkitImage; +import sun.awt.image.ImageRepresentation; +import java.util.Arrays; + +public class IconInfo { + /** + * Representation of image as an int array. + * It's used on platforms where icon data + * is expected to be in 32-bit format. + */ + private int[] intIconData; + /** + * Representation of image as an long array. + * It's used on platforms where icon data + * is expected to be in 64-bit format. + */ + private long[] longIconData; + /** + * Icon image. + */ + private Image image; + /** + * Width of icon image. Being set in constructor. + */ + private final int width; + /** + * Height of icon image. Being set in constructor. + */ + private final int height; + /** + * Width of scaled icon image. Can be set in setScaledDimension. + */ + private int scaledWidth; + /** + * Height of scaled icon image. Can be set in setScaledDimension. + */ + private int scaledHeight; + /** + * Length of raw data. Being set in constructor / setScaledDimension. + */ + private int rawLength; + + public IconInfo(int[] intIconData) { + this.intIconData = + (null == intIconData) ? null : Arrays.copyOf(intIconData, intIconData.length); + this.width = intIconData[0]; + this.height = intIconData[1]; + this.scaledWidth = width; + this.scaledHeight = height; + this.rawLength = width * height + 2; + } + + public IconInfo(long[] longIconData) { + this.longIconData = + (null == longIconData) ? null : Arrays.copyOf(longIconData, longIconData.length); + this.width = (int)longIconData[0]; + this.height = (int)longIconData[1]; + this.scaledWidth = width; + this.scaledHeight = height; + this.rawLength = width * height + 2; + } + + public IconInfo(Image image) { + this.image = image; + if (image instanceof ToolkitImage) { + ImageRepresentation ir = ((ToolkitImage)image).getImageRep(); + ir.reconstruct(ImageObserver.ALLBITS); + this.width = ir.getWidth(); + this.height = ir.getHeight(); + } else { + this.width = image.getWidth(null); + this.height = image.getHeight(null); + } + this.scaledWidth = width; + this.scaledHeight = height; + this.rawLength = width * height + 2; + } + + /* + * It sets size of scaled icon. + */ + public void setScaledSize(int width, int height) { + this.scaledWidth = width; + this.scaledHeight = height; + this.rawLength = width * height + 2; + } + + public boolean isValid() { + return (width > 0 && height > 0); + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + public String toString() { + return "IconInfo[w=" + width + ",h=" + height + ",sw=" + scaledWidth + ",sh=" + scaledHeight + "]"; + } + + public int getRawLength() { + return rawLength; + } + + public int[] getIntData() { + if (this.intIconData == null) { + if (this.longIconData != null) { + this.intIconData = longArrayToIntArray(longIconData); + } else if (this.image != null) { + this.intIconData = imageToIntArray(this.image, scaledWidth, scaledHeight); + } + } + return this.intIconData; + } + + public long[] getLongData() { + if (this.longIconData == null) { + if (this.intIconData != null) { + this.longIconData = intArrayToLongArray(this.intIconData); + } else if (this.image != null) { + int[] intIconData = imageToIntArray(this.image, scaledWidth, scaledHeight); + this.longIconData = intArrayToLongArray(intIconData); + } + } + return this.longIconData; + } + + public Image getImage() { + if (this.image == null) { + if (this.intIconData != null) { + this.image = intArrayToImage(this.intIconData); + } else if (this.longIconData != null) { + int[] intIconData = longArrayToIntArray(this.longIconData); + this.image = intArrayToImage(intIconData); + } + } + return this.image; + } + + private static int[] longArrayToIntArray(long[] longData) { + int[] intData = new int[longData.length]; + for (int i = 0; i < longData.length; i++) { + // Such a conversion is valid since the + // original data (see + // make/sun/xawt/ToBin.java) were ints + intData[i] = (int)longData[i]; + } + return intData; + } + + private static long[] intArrayToLongArray(int[] intData) { + long[] longData = new long[intData.length]; + for (int i = 0; i < intData.length; i++) { + longData[i] = (int)intData[i]; + } + return longData; + } + + static Image intArrayToImage(int[] raw) { + ColorModel cm = + new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 32, + 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, + false, DataBuffer.TYPE_INT); + DataBuffer buffer = new DataBufferInt(raw, raw.length-2, 2); + WritableRaster raster = + Raster.createPackedRaster(buffer, raw[0], raw[1], + raw[0], + new int[] {0x00ff0000, 0x0000ff00, + 0x000000ff, 0xff000000}, + null); + BufferedImage im = new BufferedImage(cm, raster, false, null); + return im; + } + + /* + * Returns array of integers which holds data for the image. + * It scales the image if necessary. + */ + static int[] imageToIntArray(Image image, int width, int height) { + if (width <= 0 || height <= 0) { + return null; + } + ColorModel cm = + new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 32, + 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, + false, DataBuffer.TYPE_INT); + DataBufferInt buffer = new DataBufferInt(width * height); + WritableRaster raster = + Raster.createPackedRaster(buffer, width, height, + width, + new int[] {0x00ff0000, 0x0000ff00, + 0x000000ff, 0xff000000}, + null); + BufferedImage im = new BufferedImage(cm, raster, false, null); + Graphics g = im.getGraphics(); + g.drawImage(image, 0, 0, width, height, null); + g.dispose(); + int[] data = buffer.getData(); + int[] raw = new int[width * height + 2]; + raw[0] = width; + raw[1] = height; + System.arraycopy(data, 0, raw, 2, width * height); + return raw; + } + +}
--- a/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java Wed Jun 12 11:21:44 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import java.awt.event.InvocationEvent; import java.awt.event.WindowEvent; +import sun.awt.IconInfo; import sun.util.logging.PlatformLogger; import sun.awt.AWTAccessor; @@ -106,7 +107,7 @@ focusProxy = createFocusProxy(); } - void setIconHints(java.util.List<XIconInfo> icons) { + void setIconHints(java.util.List<IconInfo> icons) { if (!XWM.getWM().setNetWMIcon(this, icons)) { if (icons.size() > 0) { if (iconWindow == null) {
--- a/src/solaris/classes/sun/awt/X11/XIconInfo.java Wed Jun 12 11:01:08 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package sun.awt.X11; -import java.awt.*; -import java.awt.color.*; -import java.awt.image.*; -import sun.awt.image.ToolkitImage; -import sun.awt.image.ImageRepresentation; -import java.util.Arrays; - -class XIconInfo { - /** - * Representation of image as an int array - * It's being used for _NET_WM_ICON hint - * with 32-bit X data model - */ - private int[] intIconData; - /** - * Representation of image as an int array - * It's being used for _NET_WM_ICON hint - * with 64-bit X data model - */ - private long[] longIconData; - /** - * Icon image. - */ - private Image image; - /** - * Width of icon image. Being set in constructor. - */ - private final int width; - /** - * Height of icon image. Being set in constructor. - */ - private final int height; - /** - * Width of scaled icon image. Can be set in setScaledDimension. - */ - private int scaledWidth; - /** - * Height of scaled icon image. Can be set in setScaledDimension. - */ - private int scaledHeight; - /** - * Length of raw data. Being set in constructor / setScaledDimension. - */ - private int rawLength; - - XIconInfo(int[] intIconData) { - this.intIconData = - (null == intIconData) ? null : Arrays.copyOf(intIconData, intIconData.length); - this.width = intIconData[0]; - this.height = intIconData[1]; - this.scaledWidth = width; - this.scaledHeight = height; - this.rawLength = width * height + 2; - } - - XIconInfo(long[] longIconData) { - this.longIconData = - (null == longIconData) ? null : Arrays.copyOf(longIconData, longIconData.length); - this.width = (int)longIconData[0]; - this.height = (int)longIconData[1]; - this.scaledWidth = width; - this.scaledHeight = height; - this.rawLength = width * height + 2; - } - - XIconInfo(Image image) { - this.image = image; - if (image instanceof ToolkitImage) { - ImageRepresentation ir = ((ToolkitImage)image).getImageRep(); - ir.reconstruct(ImageObserver.ALLBITS); - this.width = ir.getWidth(); - this.height = ir.getHeight(); - } else { - this.width = image.getWidth(null); - this.height = image.getHeight(null); - } - this.scaledWidth = width; - this.scaledHeight = height; - this.rawLength = width * height + 2; - } - - /* - * It sets size of scaled icon. - */ - void setScaledSize(int width, int height) { - this.scaledWidth = width; - this.scaledHeight = height; - this.rawLength = width * height + 2; - } - - boolean isValid() { - return (width > 0 && height > 0); - } - - int getWidth() { - return width; - } - - int getHeight() { - return height; - } - - public String toString() { - return "XIconInfo[w=" + width + ",h=" + height + ",sw=" + scaledWidth + ",sh=" + scaledHeight + "]"; - } - - int getRawLength() { - return rawLength; - } - - int[] getIntData() { - if (this.intIconData == null) { - if (this.longIconData != null) { - this.intIconData = longArrayToIntArray(longIconData); - } else if (this.image != null) { - this.intIconData = imageToIntArray(this.image, scaledWidth, scaledHeight); - } - } - return this.intIconData; - } - - long[] getLongData() { - if (this.longIconData == null) { - if (this.intIconData != null) { - this.longIconData = intArrayToLongArray(this.intIconData); - } else if (this.image != null) { - int[] intIconData = imageToIntArray(this.image, scaledWidth, scaledHeight); - this.longIconData = intArrayToLongArray(intIconData); - } - } - return this.longIconData; - } - - Image getImage() { - if (this.image == null) { - if (this.intIconData != null) { - this.image = intArrayToImage(this.intIconData); - } else if (this.longIconData != null) { - int[] intIconData = longArrayToIntArray(this.longIconData); - this.image = intArrayToImage(intIconData); - } - } - return this.image; - } - - private static int[] longArrayToIntArray(long[] longData) { - int[] intData = new int[longData.length]; - for (int i = 0; i < longData.length; i++) { - // Such a conversion is valid since the - // original data (see - // make/sun/xawt/ToBin.java) were ints - intData[i] = (int)longData[i]; - } - return intData; - } - - private static long[] intArrayToLongArray(int[] intData) { - long[] longData = new long[intData.length]; - for (int i = 0; i < intData.length; i++) { - longData[i] = (int)intData[i]; - } - return longData; - } - - static Image intArrayToImage(int[] raw) { - ColorModel cm = - new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 32, - 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, - false, DataBuffer.TYPE_INT); - DataBuffer buffer = new DataBufferInt(raw, raw.length-2, 2); - WritableRaster raster = - Raster.createPackedRaster(buffer, raw[0], raw[1], - raw[0], - new int[] {0x00ff0000, 0x0000ff00, - 0x000000ff, 0xff000000}, - null); - BufferedImage im = new BufferedImage(cm, raster, false, null); - return im; - } - - /* - * Returns array of integers which holds data for the image. - * It scales the image if necessary. - */ - static int[] imageToIntArray(Image image, int width, int height) { - if (width <= 0 || height <= 0) { - return null; - } - ColorModel cm = - new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 32, - 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, - false, DataBuffer.TYPE_INT); - DataBufferInt buffer = new DataBufferInt(width * height); - WritableRaster raster = - Raster.createPackedRaster(buffer, width, height, - width, - new int[] {0x00ff0000, 0x0000ff00, - 0x000000ff, 0xff000000}, - null); - BufferedImage im = new BufferedImage(cm, raster, false, null); - Graphics g = im.getGraphics(); - g.drawImage(image, 0, 0, width, height, null); - g.dispose(); - int[] data = buffer.getData(); - int[] raw = new int[width * height + 2]; - raw[0] = width; - raw[1] = height; - System.arraycopy(data, 0, raw, 2, width * height); - return raw; - } - -}
--- a/src/solaris/classes/sun/awt/X11/XIconWindow.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/solaris/classes/sun/awt/X11/XIconWindow.java Wed Jun 12 11:21:44 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,8 @@ import java.awt.*; import java.awt.image.*; -import sun.awt.X11GraphicsConfig; + +import sun.awt.IconInfo; import sun.awt.image.ToolkitImage; import sun.awt.image.ImageRepresentation; @@ -398,12 +399,12 @@ * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ - void setIconImages(java.util.List<XIconInfo> icons) { + void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; - for (XIconInfo iconInfo : icons) { + for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null));
--- a/src/solaris/classes/sun/awt/X11/XNETProtocol.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/solaris/classes/sun/awt/X11/XNETProtocol.java Wed Jun 12 11:21:44 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ package sun.awt.X11; import java.awt.Frame; + +import sun.awt.IconInfo; import sun.util.logging.PlatformLogger; final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProtocol @@ -350,10 +352,10 @@ } /** - * Sets _NET_WM_ICON property on the window using the List of XIconInfo + * Sets _NET_WM_ICON property on the window using the List of IconInfo * If icons is null or empty list, removes _NET_WM_ICON property */ - public void setWMIcons(XWindowPeer window, java.util.List<XIconInfo> icons) { + public void setWMIcons(XWindowPeer window, java.util.List<IconInfo> icons) { if (window == null) return; XAtom iconsAtom = XAtom.get("_NET_WM_ICON"); @@ -363,7 +365,7 @@ } int length = 0; - for (XIconInfo ii : icons) { + for (IconInfo ii : icons) { length += ii.getRawLength(); } int cardinalSize = (XlibWrapper.dataModel == 32) ? 4 : 8; @@ -373,7 +375,7 @@ long buffer = XlibWrapper.unsafe.allocateMemory(bufferSize); try { long ptr = buffer; - for (XIconInfo ii : icons) { + for (IconInfo ii : icons) { int size = ii.getRawLength() * cardinalSize; if (XlibWrapper.dataModel == 32) { XlibWrapper.copyIntArray(ptr, ii.getIntData(), size);
--- a/src/solaris/classes/sun/awt/X11/XWM.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/solaris/classes/sun/awt/X11/XWM.java Wed Jun 12 11:21:44 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ */ package sun.awt.X11; +import sun.awt.IconInfo; import sun.misc.Unsafe; import java.awt.Insets; import java.awt.Frame; @@ -1678,7 +1679,7 @@ * * @return true if hint was modified successfully, false otherwise */ - public boolean setNetWMIcon(XWindowPeer window, java.util.List<XIconInfo> icons) { + public boolean setNetWMIcon(XWindowPeer window, java.util.List<IconInfo> icons) { if (g_net_protocol != null && g_net_protocol.active()) { g_net_protocol.setWMIcons(window, icons); return getWMID() != ICE_WM;
--- a/src/solaris/classes/sun/awt/X11/XWarningWindow.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/solaris/classes/sun/awt/X11/XWarningWindow.java Wed Jun 12 11:21:44 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,10 @@ package sun.awt.X11; import java.awt.*; -import java.awt.event.*; import java.awt.geom.Point2D; import java.lang.ref.WeakReference; -import sun.java2d.SunGraphics2D; -import sun.java2d.pipe.Region; + +import sun.awt.IconInfo; import sun.awt.AWTAccessor; import sun.awt.SunToolkit; @@ -56,37 +55,37 @@ * 3 - 48x48 */ private int currentSize = -1; - private static XIconInfo[][] icons; - private static XIconInfo getSecurityIconInfo(int size, int num) { + private static IconInfo[][] icons; + private static IconInfo getSecurityIconInfo(int size, int num) { synchronized (XWarningWindow.class) { if (icons == null) { - icons = new XIconInfo[4][3]; + icons = new IconInfo[4][3]; if (XlibWrapper.dataModel == 32) { - icons[0][0] = new XIconInfo(XAWTIcon32_security_icon_bw16_png.security_icon_bw16_png); - icons[0][1] = new XIconInfo(XAWTIcon32_security_icon_interim16_png.security_icon_interim16_png); - icons[0][2] = new XIconInfo(XAWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png); - icons[1][0] = new XIconInfo(XAWTIcon32_security_icon_bw24_png.security_icon_bw24_png); - icons[1][1] = new XIconInfo(XAWTIcon32_security_icon_interim24_png.security_icon_interim24_png); - icons[1][2] = new XIconInfo(XAWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png); - icons[2][0] = new XIconInfo(XAWTIcon32_security_icon_bw32_png.security_icon_bw32_png); - icons[2][1] = new XIconInfo(XAWTIcon32_security_icon_interim32_png.security_icon_interim32_png); - icons[2][2] = new XIconInfo(XAWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png); - icons[3][0] = new XIconInfo(XAWTIcon32_security_icon_bw48_png.security_icon_bw48_png); - icons[3][1] = new XIconInfo(XAWTIcon32_security_icon_interim48_png.security_icon_interim48_png); - icons[3][2] = new XIconInfo(XAWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png); + icons[0][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw16_png.security_icon_bw16_png); + icons[0][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim16_png.security_icon_interim16_png); + icons[0][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png); + icons[1][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw24_png.security_icon_bw24_png); + icons[1][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim24_png.security_icon_interim24_png); + icons[1][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png); + icons[2][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw32_png.security_icon_bw32_png); + icons[2][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim32_png.security_icon_interim32_png); + icons[2][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png); + icons[3][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw48_png.security_icon_bw48_png); + icons[3][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim48_png.security_icon_interim48_png); + icons[3][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png); } else { - icons[0][0] = new XIconInfo(XAWTIcon64_security_icon_bw16_png.security_icon_bw16_png); - icons[0][1] = new XIconInfo(XAWTIcon64_security_icon_interim16_png.security_icon_interim16_png); - icons[0][2] = new XIconInfo(XAWTIcon64_security_icon_yellow16_png.security_icon_yellow16_png); - icons[1][0] = new XIconInfo(XAWTIcon64_security_icon_bw24_png.security_icon_bw24_png); - icons[1][1] = new XIconInfo(XAWTIcon64_security_icon_interim24_png.security_icon_interim24_png); - icons[1][2] = new XIconInfo(XAWTIcon64_security_icon_yellow24_png.security_icon_yellow24_png); - icons[2][0] = new XIconInfo(XAWTIcon64_security_icon_bw32_png.security_icon_bw32_png); - icons[2][1] = new XIconInfo(XAWTIcon64_security_icon_interim32_png.security_icon_interim32_png); - icons[2][2] = new XIconInfo(XAWTIcon64_security_icon_yellow32_png.security_icon_yellow32_png); - icons[3][0] = new XIconInfo(XAWTIcon64_security_icon_bw48_png.security_icon_bw48_png); - icons[3][1] = new XIconInfo(XAWTIcon64_security_icon_interim48_png.security_icon_interim48_png); - icons[3][2] = new XIconInfo(XAWTIcon64_security_icon_yellow48_png.security_icon_yellow48_png); + icons[0][0] = new IconInfo(sun.awt.AWTIcon64_security_icon_bw16_png.security_icon_bw16_png); + icons[0][1] = new IconInfo(sun.awt.AWTIcon64_security_icon_interim16_png.security_icon_interim16_png); + icons[0][2] = new IconInfo(sun.awt.AWTIcon64_security_icon_yellow16_png.security_icon_yellow16_png); + icons[1][0] = new IconInfo(sun.awt.AWTIcon64_security_icon_bw24_png.security_icon_bw24_png); + icons[1][1] = new IconInfo(sun.awt.AWTIcon64_security_icon_interim24_png.security_icon_interim24_png); + icons[1][2] = new IconInfo(sun.awt.AWTIcon64_security_icon_yellow24_png.security_icon_yellow24_png); + icons[2][0] = new IconInfo(sun.awt.AWTIcon64_security_icon_bw32_png.security_icon_bw32_png); + icons[2][1] = new IconInfo(sun.awt.AWTIcon64_security_icon_interim32_png.security_icon_interim32_png); + icons[2][2] = new IconInfo(sun.awt.AWTIcon64_security_icon_yellow32_png.security_icon_yellow32_png); + icons[3][0] = new IconInfo(sun.awt.AWTIcon64_security_icon_bw48_png.security_icon_bw48_png); + icons[3][1] = new IconInfo(sun.awt.AWTIcon64_security_icon_interim48_png.security_icon_interim48_png); + icons[3][2] = new IconInfo(sun.awt.AWTIcon64_security_icon_yellow48_png.security_icon_yellow48_png); } } } @@ -125,7 +124,7 @@ try { if (newSize != currentSize) { currentSize = newSize; - XIconInfo ico = getSecurityIconInfo(currentSize, 0); + IconInfo ico = getSecurityIconInfo(currentSize, 0); XlibWrapper.SetBitmapShape(XToolkit.getDisplay(), getWindow(), ico.getWidth(), ico.getHeight(), ico.getIntData()); AWTAccessor.getWindowAccessor().setSecurityWarningSize( @@ -136,7 +135,7 @@ } } - private XIconInfo getSecurityIconInfo() { + private IconInfo getSecurityIconInfo() { updateIconSize(); return getSecurityIconInfo(currentSize, currentIcon); }
--- a/src/solaris/classes/sun/awt/X11/XWindowAttributesData.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/solaris/classes/sun/awt/X11/XWindowAttributesData.java Wed Jun 12 11:21:44 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,8 +23,7 @@ * questions. */ package sun.awt.X11; -import java.awt.Image; -import java.util.ArrayList; +import sun.awt.IconInfo; class XWindowAttributesData { static int NORMAL = 0; @@ -51,7 +50,7 @@ boolean initialResizability; int visibilityState; // updated by native X11 event handling code. String title; - java.util.List<XIconInfo> icons; + java.util.List<IconInfo> icons; boolean iconsInherited; int decorations; // for future expansion to be able to // specify native decorations
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java Wed Jun 12 11:01:08 2013 +0100 +++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java Wed Jun 12 11:21:44 2013 +0100 @@ -30,8 +30,6 @@ import java.awt.event.FocusEvent; import java.awt.event.WindowEvent; -import java.awt.image.BufferedImage; - import java.awt.peer.ComponentPeer; import java.awt.peer.WindowPeer; @@ -55,6 +53,7 @@ import sun.awt.SunToolkit; import sun.awt.X11GraphicsDevice; import sun.awt.X11GraphicsEnvironment; +import sun.awt.IconInfo; import sun.java2d.pipe.Region; @@ -291,7 +290,7 @@ Window target = (Window)this.target; java.util.List<Image> iconImages = ((Window)target).getIconImages(); XWindowPeer ownerPeer = getOwnerPeer(); - winAttr.icons = new ArrayList<XIconInfo>(); + winAttr.icons = new ArrayList<IconInfo>(); if (iconImages.size() != 0) { //read icon images from target winAttr.iconsInherited = false; @@ -303,9 +302,9 @@ } continue; } - XIconInfo iconInfo; + IconInfo iconInfo; try { - iconInfo = new XIconInfo(image); + iconInfo = new IconInfo(image); } catch (Exception e){ if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("XWindowPeer.updateIconImages: Perhaps the image passed into Java is broken. Skipping this icon."); @@ -343,12 +342,12 @@ * It does scale some of these icons to appropriate size * if it's necessary. */ - static java.util.List<XIconInfo> normalizeIconImages(java.util.List<XIconInfo> icons) { - java.util.List<XIconInfo> result = new ArrayList<XIconInfo>(); + static java.util.List<IconInfo> normalizeIconImages(java.util.List<IconInfo> icons) { + java.util.List<IconInfo> result = new ArrayList<IconInfo>(); int totalLength = 0; boolean haveLargeIcon = false; - for (XIconInfo icon : icons) { + for (IconInfo icon : icons) { int width = icon.getWidth(); int height = icon.getHeight(); int length = icon.getRawLength(); @@ -389,16 +388,16 @@ /* * Dumps each icon from the list */ - static void dumpIcons(java.util.List<XIconInfo> icons) { + static void dumpIcons(java.util.List<IconInfo> icons) { if (iconLog.isLoggable(PlatformLogger.FINEST)) { iconLog.finest(">>> Sizes of icon images:"); - for (Iterator<XIconInfo> i = icons.iterator(); i.hasNext(); ) { + for (Iterator<IconInfo> i = icons.iterator(); i.hasNext(); ) { iconLog.finest(" {0}", i.next()); } } } - public void recursivelySetIcon(java.util.List<XIconInfo> icons) { + public void recursivelySetIcon(java.util.List<IconInfo> icons) { dumpIcons(winAttr.icons); setIconHints(icons); Window target = (Window)this.target; @@ -415,28 +414,28 @@ } } - java.util.List<XIconInfo> getIconInfo() { + java.util.List<IconInfo> getIconInfo() { return winAttr.icons; } - void setIconHints(java.util.List<XIconInfo> icons) { + void setIconHints(java.util.List<IconInfo> icons) { //This does nothing for XWindowPeer, //It's overriden in XDecoratedPeer } - private static ArrayList<XIconInfo> defaultIconInfo; - protected synchronized static java.util.List<XIconInfo> getDefaultIconInfo() { + private static ArrayList<IconInfo> defaultIconInfo; + protected synchronized static java.util.List<IconInfo> getDefaultIconInfo() { if (defaultIconInfo == null) { - defaultIconInfo = new ArrayList<XIconInfo>(); + defaultIconInfo = new ArrayList<IconInfo>(); if (XlibWrapper.dataModel == 32) { - defaultIconInfo.add(new XIconInfo(XAWTIcon32_java_icon16_png.java_icon16_png)); - defaultIconInfo.add(new XIconInfo(XAWTIcon32_java_icon24_png.java_icon24_png)); - defaultIconInfo.add(new XIconInfo(XAWTIcon32_java_icon32_png.java_icon32_png)); - defaultIconInfo.add(new XIconInfo(XAWTIcon32_java_icon48_png.java_icon48_png)); + defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon32_java_icon16_png.java_icon16_png)); + defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon32_java_icon24_png.java_icon24_png)); + defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon32_java_icon32_png.java_icon32_png)); + defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon32_java_icon48_png.java_icon48_png)); } else { - defaultIconInfo.add(new XIconInfo(XAWTIcon64_java_icon16_png.java_icon16_png)); - defaultIconInfo.add(new XIconInfo(XAWTIcon64_java_icon24_png.java_icon24_png)); - defaultIconInfo.add(new XIconInfo(XAWTIcon64_java_icon32_png.java_icon32_png)); - defaultIconInfo.add(new XIconInfo(XAWTIcon64_java_icon48_png.java_icon48_png)); + defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon64_java_icon16_png.java_icon16_png)); + defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon64_java_icon24_png.java_icon24_png)); + defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon64_java_icon32_png.java_icon32_png)); + defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon64_java_icon48_png.java_icon48_png)); } } return defaultIconInfo;