Merge
@ -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.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -38,6 +38,10 @@ include $(BUILDDIR)/common/Defs.gmk
|
|||||||
|
|
||||||
OTHER_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES
|
OTHER_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES
|
||||||
|
|
||||||
|
ifneq ($(PLATFORM), windows)
|
||||||
|
CLASSES_INIT += $(TEMPDIR)/.gen_icons
|
||||||
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
# Files
|
# Files
|
||||||
#
|
#
|
||||||
@ -208,6 +212,79 @@ ifdef ALT_COMPILEFONTCONFIG_FLAGS
|
|||||||
endif
|
endif
|
||||||
build: fontconfigs
|
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)
|
ifeq ($(PLATFORM), windows)
|
||||||
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv WINDOWS
|
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv WINDOWS
|
||||||
@ -565,5 +642,5 @@ CLASSES.export += java.io.InputStream \
|
|||||||
java.lang.Integer \
|
java.lang.Integer \
|
||||||
java.lang.ThreadGroup
|
java.lang.ThreadGroup
|
||||||
|
|
||||||
.PHONY: dgalibs dgalib.clean fontconfigs fontconfigs.clean
|
.PHONY: dgalibs dgalib.clean fontconfigs fontconfigs.clean generated.clean
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,7 +23,7 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sun.awt.X11;
|
package sun.awt;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -109,6 +109,7 @@ FILES_export = \
|
|||||||
sun/lwawt/LWToolkit.java \
|
sun/lwawt/LWToolkit.java \
|
||||||
sun/lwawt/LWWindowPeer.java \
|
sun/lwawt/LWWindowPeer.java \
|
||||||
sun/lwawt/PlatformWindow.java \
|
sun/lwawt/PlatformWindow.java \
|
||||||
|
sun/lwawt/SecurityWarningWindow.java \
|
||||||
sun/lwawt/SelectionClearListener.java \
|
sun/lwawt/SelectionClearListener.java \
|
||||||
sun/lwawt/macosx/CPrinterDevice.java \
|
sun/lwawt/macosx/CPrinterDevice.java \
|
||||||
sun/lwawt/macosx/CPrinterDialog.java \
|
sun/lwawt/macosx/CPrinterDialog.java \
|
||||||
@ -143,6 +144,7 @@ FILES_export = \
|
|||||||
sun/lwawt/macosx/CMouseInfoPeer.java \
|
sun/lwawt/macosx/CMouseInfoPeer.java \
|
||||||
sun/lwawt/macosx/CPlatformView.java \
|
sun/lwawt/macosx/CPlatformView.java \
|
||||||
sun/lwawt/macosx/CPlatformWindow.java \
|
sun/lwawt/macosx/CPlatformWindow.java \
|
||||||
|
sun/lwawt/macosx/CWarningWindow.java \
|
||||||
sun/lwawt/macosx/CPlatformComponent.java \
|
sun/lwawt/macosx/CPlatformComponent.java \
|
||||||
sun/lwawt/macosx/CEmbeddedFrame.java \
|
sun/lwawt/macosx/CEmbeddedFrame.java \
|
||||||
sun/lwawt/macosx/CPlatformEmbeddedFrame.java \
|
sun/lwawt/macosx/CPlatformEmbeddedFrame.java \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -32,7 +32,7 @@ include $(BUILDDIR)/common/Defs.gmk
|
|||||||
|
|
||||||
GEN_DIR=$(GENSRCDIR)/sun/awt/X11
|
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
|
.PHONY: generated.clean
|
||||||
|
|
||||||
@ -317,70 +317,7 @@ generated.clean:
|
|||||||
$(RM) -r $(WRAPPER_GENERATOR_TEMPDIR)
|
$(RM) -r $(WRAPPER_GENERATOR_TEMPDIR)
|
||||||
$(RM) -r $(WRAPPER_GENERATOR_DIR)
|
$(RM) -r $(WRAPPER_GENERATOR_DIR)
|
||||||
$(RM) -r $(GEN_DIR)/*.java
|
$(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
|
clean clobber:: generated.clean
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -67,7 +67,7 @@ GENSRC += $(GENSRC_EXCEPTIONS)
|
|||||||
|
|
||||||
ifneq ($(OPENJDK_TARGET_OS),windows)
|
ifneq ($(OPENJDK_TARGET_OS),windows)
|
||||||
include GensrcIcons.gmk
|
include GensrcIcons.gmk
|
||||||
GENSRC += $(GENSRC_X11_ICONS)
|
GENSRC += $(GENSRC_AWT_ICONS)
|
||||||
|
|
||||||
ifeq ($(OPENJDK_TARGET_OS),macosx)
|
ifeq ($(OPENJDK_TARGET_OS),macosx)
|
||||||
GENSRC += $(GENSRC_OSX_ICONS)
|
GENSRC += $(GENSRC_OSX_ICONS)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,10 +23,10 @@
|
|||||||
# questions.
|
# questions.
|
||||||
#
|
#
|
||||||
|
|
||||||
GENSRC_X11_ICONS :=
|
GENSRC_AWT_ICONS :=
|
||||||
GENSRC_X11_ICONS_SRC :=
|
GENSRC_AWT_ICONS_SRC :=
|
||||||
GENSRC_X11_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc
|
GENSRC_AWT_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc
|
||||||
GENSRC_X11_ICONS_DST := $(GENSRC_X11_ICONS_TMP)/sun/awt/X11
|
GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/sun/awt/
|
||||||
|
|
||||||
ifdef OPENJDK
|
ifdef OPENJDK
|
||||||
X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)
|
X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)
|
||||||
@ -34,76 +34,76 @@ else
|
|||||||
X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/solaris
|
X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/solaris
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GENSRC_X11_ICONS_SRC += \
|
GENSRC_AWT_ICONS_SRC += \
|
||||||
$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \
|
$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \
|
||||||
$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \
|
$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \
|
||||||
$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \
|
$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \
|
||||||
$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png
|
$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png
|
||||||
|
|
||||||
|
|
||||||
X11_ICONPATH := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/awt/X11
|
AWT_ICONPATH := $(JDK_TOPDIR)/src/share/classes/sun/awt/resources
|
||||||
|
|
||||||
GENSRC_X11_ICONS_SRC += \
|
GENSRC_AWT_ICONS_SRC += \
|
||||||
$(X11_ICONPATH)/security-icon-bw16.png \
|
$(AWT_ICONPATH)/security-icon-bw16.png \
|
||||||
$(X11_ICONPATH)/security-icon-interim16.png \
|
$(AWT_ICONPATH)/security-icon-interim16.png \
|
||||||
$(X11_ICONPATH)/security-icon-yellow16.png \
|
$(AWT_ICONPATH)/security-icon-yellow16.png \
|
||||||
$(X11_ICONPATH)/security-icon-bw24.png \
|
$(AWT_ICONPATH)/security-icon-bw24.png \
|
||||||
$(X11_ICONPATH)/security-icon-interim24.png \
|
$(AWT_ICONPATH)/security-icon-interim24.png \
|
||||||
$(X11_ICONPATH)/security-icon-yellow24.png \
|
$(AWT_ICONPATH)/security-icon-yellow24.png \
|
||||||
$(X11_ICONPATH)/security-icon-bw32.png \
|
$(AWT_ICONPATH)/security-icon-bw32.png \
|
||||||
$(X11_ICONPATH)/security-icon-interim32.png \
|
$(AWT_ICONPATH)/security-icon-interim32.png \
|
||||||
$(X11_ICONPATH)/security-icon-yellow32.png \
|
$(AWT_ICONPATH)/security-icon-yellow32.png \
|
||||||
$(X11_ICONPATH)/security-icon-bw48.png \
|
$(AWT_ICONPATH)/security-icon-bw48.png \
|
||||||
$(X11_ICONPATH)/security-icon-interim48.png \
|
$(AWT_ICONPATH)/security-icon-interim48.png \
|
||||||
$(X11_ICONPATH)/security-icon-yellow48.png
|
$(AWT_ICONPATH)/security-icon-yellow48.png
|
||||||
|
|
||||||
GENSRC_X11_ICONS_FILES := $(notdir $(GENSRC_X11_ICONS_SRC))
|
GENSRC_AWT_ICONS_FILES := $(notdir $(GENSRC_AWT_ICONS_SRC))
|
||||||
|
|
||||||
GENSRC_X11_ICONS_SHORT_NAME = $(subst .,_,$(subst -,_,$(1)))
|
GENSRC_AWT_ICONS_SHORT_NAME = $(subst .,_,$(subst -,_,$(1)))
|
||||||
GENSRC_X11_ICONS_DST_NAME = XAWTIcon$(2)_$(subst .,_,$(subst -,_,$(1)))
|
GENSRC_AWT_ICONS_DST_NAME = AWTIcon$(2)_$(subst .,_,$(subst -,_,$(1)))
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
$(GENSRC_X11_ICONS_TMP)/_the.icons.dir :
|
$(GENSRC_AWT_ICONS_TMP)/_the.icons.dir :
|
||||||
$(ECHO) Generating icon classes
|
$(ECHO) Generating icon classes
|
||||||
$(MKDIR) -p $(GENSRC_X11_ICONS_DST)
|
$(MKDIR) -p $(GENSRC_AWT_ICONS_DST)
|
||||||
$(TOUCH) $@
|
$(TOUCH) $@
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
define SetupGensrcX11Icon
|
define SetupGensrcAWTIcon
|
||||||
# param 1 is for src-file
|
# param 1 is for src-file
|
||||||
# param 2 is for src-dir
|
# param 2 is for src-dir
|
||||||
$1_SHORTNAME := $(call GENSRC_X11_ICONS_SHORT_NAME,$1)
|
$1_SHORTNAME := $(call GENSRC_AWT_ICONS_SHORT_NAME,$1)
|
||||||
$1_NAME32 := $(call GENSRC_X11_ICONS_DST_NAME,$1,32)
|
$1_NAME32 := $(call GENSRC_AWT_ICONS_DST_NAME,$1,32)
|
||||||
$1_TARGET32 := $(GENSRC_X11_ICONS_DST)/$$($1_NAME32).java
|
$1_TARGET32 := $(GENSRC_AWT_ICONS_DST)/$$($1_NAME32).java
|
||||||
$1_NAME64 := $(call GENSRC_X11_ICONS_DST_NAME,$1,64)
|
$1_NAME64 := $(call GENSRC_AWT_ICONS_DST_NAME,$1,64)
|
||||||
$1_TARGET64 := $(GENSRC_X11_ICONS_DST)/$$($1_NAME64).java
|
$1_TARGET64 := $(GENSRC_AWT_ICONS_DST)/$$($1_NAME64).java
|
||||||
|
|
||||||
$$($1_TARGET32) : $2/$1 $(GENSRC_X11_ICONS_TMP)/_the.icons.dir
|
$$($1_TARGET32) : $2/$1 $(GENSRC_AWT_ICONS_TMP)/_the.icons.dir
|
||||||
$(RM) $$@ $$@.tmp
|
$(RM) $$@ $$@.tmp
|
||||||
$(ECHO) "package sun.awt.X11;" > $$@.tmp
|
$(ECHO) "package sun.awt;" > $$@.tmp
|
||||||
$(ECHO) "public class $$($1_NAME32) {" >> $$@.tmp
|
$(ECHO) "public class $$($1_NAME32) {" >> $$@.tmp
|
||||||
$(ECHO) "public static int[] $$($1_SHORTNAME) = { " >> $$@.tmp
|
$(ECHO) "public static int[] $$($1_SHORTNAME) = { " >> $$@.tmp
|
||||||
$(CAT) $$< | $(TOOL_X11_TOBIN) >> $$@.tmp
|
$(CAT) $$< | $(TOOL_AWT_TOBIN) >> $$@.tmp
|
||||||
$(ECHO) "}; }" >> $$@.tmp
|
$(ECHO) "}; }" >> $$@.tmp
|
||||||
$(MV) $$@.tmp $$@
|
$(MV) $$@.tmp $$@
|
||||||
|
|
||||||
GENSRC_X11_ICONS += $$($1_TARGET32)
|
GENSRC_AWT_ICONS += $$($1_TARGET32)
|
||||||
|
|
||||||
$$($1_TARGET64) : $2/$1 $(GENSRC_X11_ICONS_TMP)/_the.icons.dir
|
$$($1_TARGET64) : $2/$1 $(GENSRC_AWT_ICONS_TMP)/_the.icons.dir
|
||||||
$(RM) $$@ $$@.tmp
|
$(RM) $$@ $$@.tmp
|
||||||
$(ECHO) "package sun.awt.X11;" > $$@.tmp
|
$(ECHO) "package sun.awt;" > $$@.tmp
|
||||||
$(ECHO) "public class $$($1_NAME64) {" >> $$@.tmp
|
$(ECHO) "public class $$($1_NAME64) {" >> $$@.tmp
|
||||||
$(ECHO) "public static long[] $$($1_SHORTNAME) = { " >> $$@.tmp
|
$(ECHO) "public static long[] $$($1_SHORTNAME) = { " >> $$@.tmp
|
||||||
$(CAT) $$< | $(TOOL_X11_TOBIN) >> $$@.tmp
|
$(CAT) $$< | $(TOOL_AWT_TOBIN) >> $$@.tmp
|
||||||
$(ECHO) "}; }" >> $$@.tmp
|
$(ECHO) "}; }" >> $$@.tmp
|
||||||
$(MV) $$@.tmp $$@
|
$(MV) $$@.tmp $$@
|
||||||
|
|
||||||
GENSRC_X11_ICONS += $$($1_TARGET64)
|
GENSRC_AWT_ICONS += $$($1_TARGET64)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach I,$(GENSRC_X11_ICONS_SRC), $(eval $(call SetupGensrcX11Icon,$(notdir $(I)),$(dir $(I)))))
|
$(foreach I,$(GENSRC_AWT_ICONS_SRC), $(eval $(call SetupGensrcAWTIcon,$(notdir $(I)),$(dir $(I)))))
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,7 +29,7 @@ $(eval $(call FillCacheFind,$(JDK_TOPDIR)/make/tools \
|
|||||||
$(JDK_TOPDIR)/makefiles/sun))
|
$(JDK_TOPDIR)/makefiles/sun))
|
||||||
|
|
||||||
TOOLS_SRC:=$(JDK_TOPDIR)/make/tools/src \
|
TOOLS_SRC:=$(JDK_TOPDIR)/make/tools/src \
|
||||||
$(JDK_TOPDIR)/makefiles/sun/awt/X11 \
|
$(JDK_TOPDIR)/makefiles/sun/awt/ \
|
||||||
$(JDK_TOPDIR)/makefiles/sun/osxapp \
|
$(JDK_TOPDIR)/makefiles/sun/osxapp \
|
||||||
$(JDK_TOPDIR)/make/tools/swing-beans
|
$(JDK_TOPDIR)/make/tools/swing-beans
|
||||||
|
|
||||||
@ -134,8 +134,8 @@ TOOL_GENERATENIMBUS=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
|
|||||||
TOOL_WRAPPERGENERATOR=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
|
TOOL_WRAPPERGENERATOR=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
|
||||||
WrapperGenerator
|
WrapperGenerator
|
||||||
|
|
||||||
TOOL_X11_TOBIN=$(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
|
TOOL_AWT_TOBIN=$(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
|
||||||
sun.awt.X11.ToBin
|
sun.awt.ToBin
|
||||||
|
|
||||||
TOOL_OSX_TOBIN=$(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
|
TOOL_OSX_TOBIN=$(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
|
||||||
sun.osxapp.ToBin
|
sun.osxapp.ToBin
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,7 +23,7 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sun.awt.X11;
|
package sun.awt;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -72,8 +72,7 @@ public class CGLLayer extends CFRetainedResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getTransparency() {
|
public int getTransparency() {
|
||||||
return peer.isTranslucent() ? Transparency.TRANSLUCENT :
|
return isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT;
|
||||||
Transparency.OPAQUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getDestination() {
|
public Object getDestination() {
|
||||||
@ -81,14 +80,14 @@ public class CGLLayer extends CFRetainedResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SurfaceData replaceSurfaceData() {
|
public SurfaceData replaceSurfaceData() {
|
||||||
if (peer.getBounds().isEmpty()) {
|
if (getBounds().isEmpty()) {
|
||||||
surfaceData = NullSurfaceData.theInstance;
|
surfaceData = NullSurfaceData.theInstance;
|
||||||
return surfaceData;
|
return surfaceData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the layer redirects all painting to the buffer's graphics
|
// the layer redirects all painting to the buffer's graphics
|
||||||
// and blits the buffer to the layer surface (in drawInCGLContext callback)
|
// and blits the buffer to the layer surface (in drawInCGLContext callback)
|
||||||
CGraphicsConfig gc = (CGraphicsConfig)peer.getGraphicsConfiguration();
|
CGraphicsConfig gc = (CGraphicsConfig)getGraphicsConfiguration();
|
||||||
surfaceData = gc.createSurfaceData(this);
|
surfaceData = gc.createSurfaceData(this);
|
||||||
|
|
||||||
// the layer holds a reference to the buffer, which in
|
// the layer holds a reference to the buffer, which in
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -44,9 +44,26 @@ public class LWKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCurrentFocusedWindow(Window win) {
|
public void setCurrentFocusedWindow(Window win) {
|
||||||
|
LWWindowPeer from, to;
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
if (focusedWindow == win) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
from = (LWWindowPeer)LWToolkit.targetToPeer(focusedWindow);
|
||||||
|
to = (LWWindowPeer)LWToolkit.targetToPeer(win);
|
||||||
|
|
||||||
focusedWindow = win;
|
focusedWindow = win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (from != null) {
|
||||||
|
from.updateSecurityWarningVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to != null) {
|
||||||
|
to.updateSecurityWarningVisibility();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -508,6 +508,8 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
|||||||
return clipboard;
|
return clipboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer);
|
||||||
|
|
||||||
// ---- DELEGATES ---- //
|
// ---- DELEGATES ---- //
|
||||||
|
|
||||||
public abstract Clipboard createPlatformClipboard();
|
public abstract Clipboard createPlatformClipboard();
|
||||||
|
@ -41,8 +41,7 @@ import sun.util.logging.PlatformLogger;
|
|||||||
|
|
||||||
public class LWWindowPeer
|
public class LWWindowPeer
|
||||||
extends LWContainerPeer<Window, JComponent>
|
extends LWContainerPeer<Window, JComponent>
|
||||||
implements WindowPeer, FramePeer, DialogPeer, FullScreenCapable
|
implements WindowPeer, FramePeer, DialogPeer, FullScreenCapable, PlatformEventNotifier {
|
||||||
{
|
|
||||||
public static enum PeerType {
|
public static enum PeerType {
|
||||||
SIMPLEWINDOW,
|
SIMPLEWINDOW,
|
||||||
FRAME,
|
FRAME,
|
||||||
@ -112,6 +111,8 @@ public class LWWindowPeer
|
|||||||
|
|
||||||
private final PeerType peerType;
|
private final PeerType peerType;
|
||||||
|
|
||||||
|
private final SecurityWarningWindow warningWindow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current modal blocker or null.
|
* Current modal blocker or null.
|
||||||
*
|
*
|
||||||
@ -158,11 +159,26 @@ public class LWWindowPeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
platformWindow.initialize(target, this, ownerDelegate);
|
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
|
@Override
|
||||||
void initializeImpl() {
|
void initializeImpl() {
|
||||||
super.initializeImpl();
|
super.initializeImpl();
|
||||||
|
|
||||||
|
|
||||||
if (getTarget() instanceof Frame) {
|
if (getTarget() instanceof Frame) {
|
||||||
setTitle(((Frame) getTarget()).getTitle());
|
setTitle(((Frame) getTarget()).getTitle());
|
||||||
setState(((Frame) getTarget()).getExtendedState());
|
setState(((Frame) getTarget()).getExtendedState());
|
||||||
@ -220,12 +236,20 @@ public class LWWindowPeer
|
|||||||
if (isGrabbing()) {
|
if (isGrabbing()) {
|
||||||
ungrab();
|
ungrab();
|
||||||
}
|
}
|
||||||
|
if (warningWindow != null) {
|
||||||
|
warningWindow.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
platformWindow.dispose();
|
platformWindow.dispose();
|
||||||
super.disposeImpl();
|
super.disposeImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setVisibleImpl(final boolean visible) {
|
protected void setVisibleImpl(final boolean visible) {
|
||||||
|
if (!visible && warningWindow != null) {
|
||||||
|
warningWindow.setVisible(false, false);
|
||||||
|
}
|
||||||
|
|
||||||
super.setVisibleImpl(visible);
|
super.setVisibleImpl(visible);
|
||||||
// TODO: update graphicsConfig, see 4868278
|
// TODO: update graphicsConfig, see 4868278
|
||||||
platformWindow.setVisible(visible);
|
platformWindow.setVisible(visible);
|
||||||
@ -456,7 +480,15 @@ public class LWWindowPeer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void repositionSecurityWarning() {
|
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 ---- //
|
// ---- FRAME PEER METHODS ---- //
|
||||||
@ -516,6 +548,7 @@ public class LWWindowPeer
|
|||||||
|
|
||||||
// ---- PEER NOTIFICATIONS ---- //
|
// ---- PEER NOTIFICATIONS ---- //
|
||||||
|
|
||||||
|
@Override
|
||||||
public void notifyIconify(boolean iconify) {
|
public void notifyIconify(boolean iconify) {
|
||||||
//The toplevel target is Frame and states are applicable to it.
|
//The toplevel target is Frame and states are applicable to it.
|
||||||
//Otherwise, the target is Window and it don't have state property.
|
//Otherwise, the target is Window and it don't have state property.
|
||||||
@ -540,6 +573,7 @@ public class LWWindowPeer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void notifyZoom(boolean isZoomed) {
|
public void notifyZoom(boolean isZoomed) {
|
||||||
int newWindowState = isZoomed ? Frame.MAXIMIZED_BOTH : Frame.NORMAL;
|
int newWindowState = isZoomed ? Frame.MAXIMIZED_BOTH : Frame.NORMAL;
|
||||||
postWindowStateChangedEvent(newWindowState);
|
postWindowStateChangedEvent(newWindowState);
|
||||||
@ -549,7 +583,8 @@ public class LWWindowPeer
|
|||||||
* Called by the {@code PlatformWindow} when any part of the window should
|
* Called by the {@code PlatformWindow} when any part of the window should
|
||||||
* be repainted.
|
* be repainted.
|
||||||
*/
|
*/
|
||||||
public final void notifyExpose(final Rectangle r) {
|
@Override
|
||||||
|
public void notifyExpose(final Rectangle r) {
|
||||||
repaintPeer(r);
|
repaintPeer(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,7 +594,8 @@ public class LWWindowPeer
|
|||||||
* LWComponentPeer as the only components which could be resized by user are
|
* LWComponentPeer as the only components which could be resized by user are
|
||||||
* top-level windows.
|
* top-level windows.
|
||||||
*/
|
*/
|
||||||
public final void notifyReshape(int x, int y, int w, int h) {
|
@Override
|
||||||
|
public void notifyReshape(int x, int y, int w, int h) {
|
||||||
final boolean moved;
|
final boolean moved;
|
||||||
final boolean resized;
|
final boolean resized;
|
||||||
final boolean invalid = updateInsets(platformWindow.getInsets());
|
final boolean invalid = updateInsets(platformWindow.getInsets());
|
||||||
@ -594,6 +630,8 @@ public class LWWindowPeer
|
|||||||
handleResize(w, h, true);
|
handleResize(w, h, true);
|
||||||
repaintPeer();
|
repaintPeer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositionSecurityWarning();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearBackground(final int w, final int h) {
|
private void clearBackground(final int w, final int h) {
|
||||||
@ -621,16 +659,19 @@ public class LWWindowPeer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void notifyUpdateCursor() {
|
public void notifyUpdateCursor() {
|
||||||
getLWToolkit().getCursorManager().updateCursorLater(this);
|
getLWToolkit().getCursorManager().updateCursorLater(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void notifyActivation(boolean activation, LWWindowPeer opposite) {
|
public void notifyActivation(boolean activation, LWWindowPeer opposite) {
|
||||||
Window oppositeWindow = (opposite == null)? null : opposite.getTarget();
|
Window oppositeWindow = (opposite == null)? null : opposite.getTarget();
|
||||||
changeFocusedWindow(activation, oppositeWindow);
|
changeFocusedWindow(activation, oppositeWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseDown in non-client area
|
// MouseDown in non-client area
|
||||||
|
@Override
|
||||||
public void notifyNCMouseDown() {
|
public void notifyNCMouseDown() {
|
||||||
// Ungrab except for a click on a Dialog with the grabbing owner
|
// Ungrab except for a click on a Dialog with the grabbing owner
|
||||||
if (grabbingWindow != null &&
|
if (grabbingWindow != null &&
|
||||||
@ -647,7 +688,8 @@ public class LWWindowPeer
|
|||||||
* coordinates are relative to non-client window are, i.e. the top-left
|
* coordinates are relative to non-client window are, i.e. the top-left
|
||||||
* point of the client area is (insets.top, insets.left).
|
* point of the client area is (insets.top, insets.left).
|
||||||
*/
|
*/
|
||||||
public void dispatchMouseEvent(int id, long when, int button,
|
@Override
|
||||||
|
public void notifyMouseEvent(int id, long when, int button,
|
||||||
int x, int y, int screenX, int screenY,
|
int x, int y, int screenX, int screenY,
|
||||||
int modifiers, int clickCount, boolean popupTrigger,
|
int modifiers, int clickCount, boolean popupTrigger,
|
||||||
byte[] bdata)
|
byte[] bdata)
|
||||||
@ -663,11 +705,9 @@ public class LWWindowPeer
|
|||||||
if (lastMouseEventPeer.isEnabled()) {
|
if (lastMouseEventPeer.isEnabled()) {
|
||||||
Point lp = lastMouseEventPeer.windowToLocal(x, y,
|
Point lp = lastMouseEventPeer.windowToLocal(x, y,
|
||||||
this);
|
this);
|
||||||
postEvent(new MouseEvent(lastMouseEventPeer.getTarget(),
|
Component target = lastMouseEventPeer.getTarget();
|
||||||
MouseEvent.MOUSE_EXITED, when,
|
postMouseExitedEvent(target, when, modifiers, lp,
|
||||||
modifiers, lp.x, lp.y, screenX,
|
screenX, screenY, clickCount, popupTrigger, button);
|
||||||
screenY, clickCount, popupTrigger,
|
|
||||||
button));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sometimes we may get MOUSE_EXITED after lastCommonMouseEventPeer is switched
|
// Sometimes we may get MOUSE_EXITED after lastCommonMouseEventPeer is switched
|
||||||
@ -683,11 +723,9 @@ public class LWWindowPeer
|
|||||||
if (targetPeer != null) {
|
if (targetPeer != null) {
|
||||||
if (targetPeer.isEnabled()) {
|
if (targetPeer.isEnabled()) {
|
||||||
Point lp = targetPeer.windowToLocal(x, y, this);
|
Point lp = targetPeer.windowToLocal(x, y, this);
|
||||||
postEvent(new MouseEvent(targetPeer.getTarget(),
|
Component target = targetPeer.getTarget();
|
||||||
MouseEvent.MOUSE_ENTERED, when,
|
postMouseEnteredEvent(target, when, modifiers, lp,
|
||||||
modifiers, lp.x, lp.y, screenX,
|
screenX, screenY, clickCount, popupTrigger, button);
|
||||||
screenY, clickCount, popupTrigger,
|
|
||||||
button));
|
|
||||||
}
|
}
|
||||||
lastCommonMouseEventPeer = targetPeer;
|
lastCommonMouseEventPeer = targetPeer;
|
||||||
lastMouseEventPeer = targetPeer;
|
lastMouseEventPeer = targetPeer;
|
||||||
@ -814,11 +852,9 @@ public class LWWindowPeer
|
|||||||
// Generate Mouse Exit for components
|
// Generate Mouse Exit for components
|
||||||
if (lastMouseEventPeer != null && lastMouseEventPeer.isEnabled()) {
|
if (lastMouseEventPeer != null && lastMouseEventPeer.isEnabled()) {
|
||||||
Point oldp = lastMouseEventPeer.windowToLocal(x, y, this);
|
Point oldp = lastMouseEventPeer.windowToLocal(x, y, this);
|
||||||
postEvent(new MouseEvent(lastMouseEventPeer.getTarget(),
|
Component target = lastMouseEventPeer.getTarget();
|
||||||
MouseEvent.MOUSE_EXITED,
|
postMouseExitedEvent(target, when, modifiers, oldp, screenX, screenY,
|
||||||
when, modifiers,
|
clickCount, popupTrigger, button);
|
||||||
oldp.x, oldp.y, screenX, screenY,
|
|
||||||
clickCount, popupTrigger, button));
|
|
||||||
}
|
}
|
||||||
lastCommonMouseEventPeer = targetPeer;
|
lastCommonMouseEventPeer = targetPeer;
|
||||||
lastMouseEventPeer = targetPeer;
|
lastMouseEventPeer = targetPeer;
|
||||||
@ -826,15 +862,39 @@ public class LWWindowPeer
|
|||||||
// Generate Mouse Enter for components
|
// Generate Mouse Enter for components
|
||||||
if (targetPeer != null && targetPeer.isEnabled()) {
|
if (targetPeer != null && targetPeer.isEnabled()) {
|
||||||
Point newp = targetPeer.windowToLocal(x, y, this);
|
Point newp = targetPeer.windowToLocal(x, y, this);
|
||||||
postEvent(new MouseEvent(targetPeer.getTarget(),
|
Component target = targetPeer.getTarget();
|
||||||
MouseEvent.MOUSE_ENTERED,
|
postMouseEnteredEvent(target, when, modifiers, newp, screenX, screenY, clickCount, popupTrigger, button);
|
||||||
when, modifiers,
|
|
||||||
newp.x, newp.y, screenX, screenY,
|
|
||||||
clickCount, popupTrigger, button));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispatchMouseWheelEvent(long when, int x, int y, int modifiers,
|
private void postMouseEnteredEvent(Component target, long when, int modifiers,
|
||||||
|
Point loc, int xAbs, int yAbs,
|
||||||
|
int clickCount, boolean popupTrigger, int button) {
|
||||||
|
|
||||||
|
updateSecurityWarningVisibility();
|
||||||
|
|
||||||
|
postEvent(new MouseEvent(target,
|
||||||
|
MouseEvent.MOUSE_ENTERED,
|
||||||
|
when, modifiers,
|
||||||
|
loc.x, loc.y, xAbs, yAbs,
|
||||||
|
clickCount, popupTrigger, button));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void postMouseExitedEvent(Component target, long when, int modifiers,
|
||||||
|
Point loc, int xAbs, int yAbs,
|
||||||
|
int clickCount, boolean popupTrigger, int button) {
|
||||||
|
|
||||||
|
updateSecurityWarningVisibility();
|
||||||
|
|
||||||
|
postEvent(new MouseEvent(target,
|
||||||
|
MouseEvent.MOUSE_EXITED,
|
||||||
|
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 scrollType, int scrollAmount,
|
||||||
int wheelRotation, double preciseWheelRotation,
|
int wheelRotation, double preciseWheelRotation,
|
||||||
byte[] bdata)
|
byte[] bdata)
|
||||||
@ -863,7 +923,8 @@ public class LWWindowPeer
|
|||||||
/*
|
/*
|
||||||
* Called by the delegate when a key is pressed.
|
* Called by the delegate when a key is pressed.
|
||||||
*/
|
*/
|
||||||
public void dispatchKeyEvent(int id, long when, int modifiers,
|
@Override
|
||||||
|
public void notifyKeyEvent(int id, long when, int modifiers,
|
||||||
int keyCode, char keyChar, int keyLocation)
|
int keyCode, char keyChar, int keyLocation)
|
||||||
{
|
{
|
||||||
LWKeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
|
LWKeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
|
||||||
@ -878,7 +939,6 @@ public class LWWindowPeer
|
|||||||
postEvent(new KeyEvent(focusOwner, id, when, modifiers, keyCode, keyChar, keyLocation));
|
postEvent(new KeyEvent(focusOwner, id, when, modifiers, keyCode, keyChar, keyLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---- UTILITY METHODS ---- //
|
// ---- UTILITY METHODS ---- //
|
||||||
|
|
||||||
private void postWindowStateChangedEvent(int newWindowState) {
|
private void postWindowStateChangedEvent(int newWindowState) {
|
||||||
@ -886,11 +946,14 @@ public class LWWindowPeer
|
|||||||
AWTAccessor.getFrameAccessor().setExtendedState(
|
AWTAccessor.getFrameAccessor().setExtendedState(
|
||||||
(Frame)getTarget(), newWindowState);
|
(Frame)getTarget(), newWindowState);
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowEvent stateChangedEvent = new WindowEvent(getTarget(),
|
WindowEvent stateChangedEvent = new WindowEvent(getTarget(),
|
||||||
WindowEvent.WINDOW_STATE_CHANGED,
|
WindowEvent.WINDOW_STATE_CHANGED,
|
||||||
windowState, newWindowState);
|
windowState, newWindowState);
|
||||||
postEvent(stateChangedEvent);
|
postEvent(stateChangedEvent);
|
||||||
windowState = newWindowState;
|
windowState = newWindowState;
|
||||||
|
|
||||||
|
updateSecurityWarningVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getGraphicsConfigScreen(GraphicsConfiguration gc) {
|
private static int getGraphicsConfigScreen(GraphicsConfiguration gc) {
|
||||||
@ -1193,10 +1256,12 @@ public class LWWindowPeer
|
|||||||
|
|
||||||
public void enterFullScreenMode() {
|
public void enterFullScreenMode() {
|
||||||
platformWindow.enterFullScreenMode();
|
platformWindow.enterFullScreenMode();
|
||||||
|
updateSecurityWarningVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exitFullScreenMode() {
|
public void exitFullScreenMode() {
|
||||||
platformWindow.exitFullScreenMode();
|
platformWindow.exitFullScreenMode();
|
||||||
|
updateSecurityWarningVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLayerPtr() {
|
public long getLayerPtr() {
|
||||||
@ -1231,6 +1296,33 @@ public class LWWindowPeer
|
|||||||
return peerType;
|
return peerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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().getCurrentFocusedWindow() ==
|
||||||
|
getTarget()) {
|
||||||
|
show = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (platformWindow.isUnderMouse() || warningWindow.isUnderMouse()) {
|
||||||
|
show = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
warningWindow.setVisible(show, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + " [target is " + getTarget() + "]";
|
return super.toString() + " [target is " + getTarget() + "]";
|
||||||
|
65
jdk/src/macosx/classes/sun/lwawt/PlatformEventNotifier.java
Normal file
@ -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(Rectangle r);
|
||||||
|
|
||||||
|
void notifyReshape(int x, int y, int w, int h);
|
||||||
|
|
||||||
|
void notifyUpdateCursor();
|
||||||
|
|
||||||
|
void notifyActivation(boolean activation, LWWindowPeer opposite);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -146,6 +146,8 @@ public interface PlatformWindow {
|
|||||||
|
|
||||||
public void exitFullScreenMode();
|
public void exitFullScreenMode();
|
||||||
|
|
||||||
|
public boolean isFullScreenMode();
|
||||||
|
|
||||||
public void setWindowState(int windowState);
|
public void setWindowState(int windowState);
|
||||||
|
|
||||||
public long getLayerPtr();
|
public long getLayerPtr();
|
||||||
|
35
jdk/src/macosx/classes/sun/lwawt/SecurityWarningWindow.java
Normal file
@ -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);
|
||||||
|
}
|
@ -185,6 +185,11 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
|
|||||||
@Override
|
@Override
|
||||||
public void exitFullScreenMode() {}
|
public void exitFullScreenMode() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFullScreenMode() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWindowState(int windowState) {}
|
public void setWindowState(int windowState) {}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,6 +27,7 @@ package sun.lwawt.macosx;
|
|||||||
|
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
import sun.lwawt.LWWindowPeer;
|
import sun.lwawt.LWWindowPeer;
|
||||||
|
import sun.lwawt.PlatformEventNotifier;
|
||||||
import sun.lwawt.macosx.event.NSEvent;
|
import sun.lwawt.macosx.event.NSEvent;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
@ -39,11 +40,12 @@ import java.awt.event.KeyEvent;
|
|||||||
*/
|
*/
|
||||||
final class CPlatformResponder {
|
final class CPlatformResponder {
|
||||||
|
|
||||||
private final LWWindowPeer peer;
|
private final PlatformEventNotifier eventNotifier;
|
||||||
private final boolean isNpapiCallback;
|
private final boolean isNpapiCallback;
|
||||||
|
|
||||||
CPlatformResponder(final LWWindowPeer peer, final boolean isNpapiCallback) {
|
CPlatformResponder(final PlatformEventNotifier eventNotifier,
|
||||||
this.peer = peer;
|
final boolean isNpapiCallback) {
|
||||||
|
this.eventNotifier = eventNotifier;
|
||||||
this.isNpapiCallback = isNpapiCallback;
|
this.isNpapiCallback = isNpapiCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +79,7 @@ final class CPlatformResponder {
|
|||||||
modifierFlags);
|
modifierFlags);
|
||||||
boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);
|
boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);
|
||||||
|
|
||||||
peer.dispatchMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
|
eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
|
||||||
x, y, absoluteX, absoluteY, jmodifiers, jclickCount,
|
x, y, absoluteX, absoluteY, jmodifiers, jclickCount,
|
||||||
jpopupTrigger, null);
|
jpopupTrigger, null);
|
||||||
}
|
}
|
||||||
@ -115,7 +117,7 @@ final class CPlatformResponder {
|
|||||||
wheelRotation = signum;
|
wheelRotation = signum;
|
||||||
}
|
}
|
||||||
// invert the wheelRotation for the peer
|
// invert the wheelRotation for the peer
|
||||||
peer.dispatchMouseWheelEvent(when, x, y, modifiers, scrollType,
|
eventNotifier.notifyMouseWheelEvent(when, x, y, modifiers, scrollType,
|
||||||
scrollAmount, -wheelRotation, -delta, null);
|
scrollAmount, -wheelRotation, -delta, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +185,7 @@ final class CPlatformResponder {
|
|||||||
int jmodifiers = NSEvent.nsToJavaKeyModifiers(modifierFlags);
|
int jmodifiers = NSEvent.nsToJavaKeyModifiers(modifierFlags);
|
||||||
long when = System.currentTimeMillis();
|
long when = System.currentTimeMillis();
|
||||||
|
|
||||||
peer.dispatchKeyEvent(jeventType, when, jmodifiers,
|
eventNotifier.notifyKeyEvent(jeventType, when, jmodifiers,
|
||||||
jkeyCode, javaChar, jkeyLocation);
|
jkeyCode, javaChar, jkeyLocation);
|
||||||
|
|
||||||
// Current browser may be sending input events, so don't
|
// Current browser may be sending input events, so don't
|
||||||
@ -197,7 +199,7 @@ final class CPlatformResponder {
|
|||||||
// for clipboard related shortcuts like Meta + [CVX]
|
// for clipboard related shortcuts like Meta + [CVX]
|
||||||
boolean isMetaDown = (jmodifiers & KeyEvent.META_DOWN_MASK) != 0;
|
boolean isMetaDown = (jmodifiers & KeyEvent.META_DOWN_MASK) != 0;
|
||||||
if (jeventType == KeyEvent.KEY_PRESSED && postsTyped && !isMetaDown) {
|
if (jeventType == KeyEvent.KEY_PRESSED && postsTyped && !isMetaDown) {
|
||||||
peer.dispatchKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers,
|
eventNotifier.notifyKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers,
|
||||||
KeyEvent.VK_UNDEFINED, javaChar,
|
KeyEvent.VK_UNDEFINED, javaChar,
|
||||||
KeyEvent.KEY_LOCATION_UNKNOWN);
|
KeyEvent.KEY_LOCATION_UNKNOWN);
|
||||||
}
|
}
|
||||||
@ -209,7 +211,7 @@ final class CPlatformResponder {
|
|||||||
char c;
|
char c;
|
||||||
while (index < length) {
|
while (index < length) {
|
||||||
c = text.charAt(index);
|
c = text.charAt(index);
|
||||||
peer.dispatchKeyEvent(KeyEvent.KEY_TYPED,
|
eventNotifier.notifyKeyEvent(KeyEvent.KEY_TYPED,
|
||||||
System.currentTimeMillis(),
|
System.currentTimeMillis(),
|
||||||
0, KeyEvent.VK_UNDEFINED, c,
|
0, KeyEvent.VK_UNDEFINED, c,
|
||||||
KeyEvent.KEY_LOCATION_UNKNOWN);
|
KeyEvent.KEY_LOCATION_UNKNOWN);
|
||||||
@ -219,6 +221,6 @@ final class CPlatformResponder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handleWindowFocusEvent(boolean gained, LWWindowPeer opposite) {
|
void handleWindowFocusEvent(boolean gained, LWWindowPeer opposite) {
|
||||||
peer.notifyActivation(gained, opposite);
|
eventNotifier.notifyActivation(gained, opposite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -57,11 +57,15 @@ public class CPlatformView extends CFRetainedResource {
|
|||||||
initializeBase(peer, responder);
|
initializeBase(peer, responder);
|
||||||
|
|
||||||
if (!LWCToolkit.getSunAwtDisableCALayers()) {
|
if (!LWCToolkit.getSunAwtDisableCALayers()) {
|
||||||
this.windowLayer = new CGLLayer(peer);
|
this.windowLayer = createCGLayer();
|
||||||
}
|
}
|
||||||
setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
|
setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CGLLayer createCGLayer() {
|
||||||
|
return new CGLLayer(peer);
|
||||||
|
}
|
||||||
|
|
||||||
protected void initializeBase(LWWindowPeer peer, CPlatformResponder responder) {
|
protected void initializeBase(LWWindowPeer peer, CPlatformResponder responder) {
|
||||||
this.peer = peer;
|
this.peer = peer;
|
||||||
this.responder = responder;
|
this.responder = responder;
|
||||||
@ -100,6 +104,10 @@ public class CPlatformView extends CFRetainedResource {
|
|||||||
CWrapper.NSView.exitFullScreenMode(ptr);
|
CWrapper.NSView.exitFullScreenMode(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setToolTip(String msg) {
|
||||||
|
CWrapper.NSView.setToolTip(ptr, msg);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// PAINTING METHODS
|
// PAINTING METHODS
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
@ -108,7 +116,7 @@ public class CPlatformView extends CFRetainedResource {
|
|||||||
surfaceData = windowLayer.replaceSurfaceData();
|
surfaceData = windowLayer.replaceSurfaceData();
|
||||||
} else {
|
} else {
|
||||||
if (surfaceData == null) {
|
if (surfaceData == null) {
|
||||||
CGraphicsConfig graphicsConfig = (CGraphicsConfig)peer.getGraphicsConfiguration();
|
CGraphicsConfig graphicsConfig = (CGraphicsConfig)getGraphicsConfiguration();
|
||||||
surfaceData = graphicsConfig.createSurfaceData(this);
|
surfaceData = graphicsConfig.createSurfaceData(this);
|
||||||
} else {
|
} else {
|
||||||
validateSurface();
|
validateSurface();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -201,9 +201,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
|
|
||||||
private Window target;
|
private Window target;
|
||||||
private LWWindowPeer peer;
|
private LWWindowPeer peer;
|
||||||
private CPlatformView contentView;
|
protected CPlatformView contentView;
|
||||||
private CPlatformWindow owner;
|
protected CPlatformWindow owner;
|
||||||
private boolean visible = false; // visibility status from native perspective
|
protected boolean visible = false; // visibility status from native perspective
|
||||||
private boolean undecorated; // initialized in getInitialStyleBits()
|
private boolean undecorated; // initialized in getInitialStyleBits()
|
||||||
private Rectangle normalBounds = null; // not-null only for undecorated maximized windows
|
private Rectangle normalBounds = null; // not-null only for undecorated maximized windows
|
||||||
private CPlatformResponder responder;
|
private CPlatformResponder responder;
|
||||||
@ -223,19 +223,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
|
|
||||||
final int styleBits = getInitialStyleBits();
|
final int styleBits = getInitialStyleBits();
|
||||||
|
|
||||||
// TODO: handle these misc properties
|
responder = createPlatformResponder();
|
||||||
final long parentNSWindowPtr = (owner != null ? owner.getNSWindowPtr() : 0);
|
contentView = createContentView();
|
||||||
String warningString = target.getWarningString();
|
|
||||||
|
|
||||||
responder = new CPlatformResponder(peer, false);
|
|
||||||
contentView.initialize(peer, responder);
|
contentView.initialize(peer, responder);
|
||||||
|
|
||||||
final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0);
|
final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0);
|
||||||
setPtr(nativeWindowPtr);
|
setPtr(nativeWindowPtr);
|
||||||
|
|
||||||
// TODO: implement on top of JObjC bridged class
|
|
||||||
// NSWindow window = JObjC.getInstance().AppKit().NSWindow().getInstance(nativeWindowPtr, JObjCRuntime.getInstance());
|
|
||||||
|
|
||||||
if (target instanceof javax.swing.RootPaneContainer) {
|
if (target instanceof javax.swing.RootPaneContainer) {
|
||||||
final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
|
final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
|
||||||
if (rootpane != null) rootpane.addPropertyChangeListener("ancestor", new PropertyChangeListener() {
|
if (rootpane != null) rootpane.addPropertyChangeListener("ancestor", new PropertyChangeListener() {
|
||||||
@ -258,7 +252,15 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
this.contentView = view;
|
this.contentView = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getInitialStyleBits() {
|
protected CPlatformResponder createPlatformResponder() {
|
||||||
|
return new CPlatformResponder(peer, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CPlatformView createContentView() {
|
||||||
|
return new CPlatformView();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getInitialStyleBits() {
|
||||||
// defaults style bits
|
// defaults style bits
|
||||||
int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE;
|
int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE;
|
||||||
|
|
||||||
@ -457,7 +459,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void maximize() {
|
private void maximize() {
|
||||||
if (isMaximized()) {
|
if (peer == null || isMaximized()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!undecorated) {
|
if (!undecorated) {
|
||||||
@ -492,7 +494,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return this.visible;
|
return this.visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,7 +526,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
updateFocusabilityForAutoRequestFocus(false);
|
updateFocusabilityForAutoRequestFocus(false);
|
||||||
|
|
||||||
// Actually show or hide the window
|
// Actually show or hide the window
|
||||||
LWWindowPeer blocker = peer.getBlocker();
|
LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
|
||||||
if (blocker == null || !visible) {
|
if (blocker == null || !visible) {
|
||||||
// If it ain't blocked, or is being hidden, go regular way
|
// If it ain't blocked, or is being hidden, go regular way
|
||||||
if (visible) {
|
if (visible) {
|
||||||
@ -716,7 +718,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
@Override
|
@Override
|
||||||
public void setOpaque(boolean isOpaque) {
|
public void setOpaque(boolean isOpaque) {
|
||||||
CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
|
CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
|
||||||
if (!isOpaque && !peer.isTextured()) {
|
boolean isTextured = (peer == null)? false : peer.isTextured();
|
||||||
|
if (!isOpaque && !isTextured) {
|
||||||
long clearColor = CWrapper.NSColor.clearColor();
|
long clearColor = CWrapper.NSColor.clearColor();
|
||||||
CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
|
CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
|
||||||
}
|
}
|
||||||
@ -755,9 +758,14 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
isFullScreenMode = false;
|
isFullScreenMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFullScreenMode() {
|
||||||
|
return isFullScreenMode;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWindowState(int windowState) {
|
public void setWindowState(int windowState) {
|
||||||
if (!peer.isVisible()) {
|
if (peer == null || !peer.isVisible()) {
|
||||||
// setVisible() applies the state
|
// setVisible() applies the state
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -904,7 +912,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
responder.handleWindowFocusEvent(gained, oppositePeer);
|
responder.handleWindowFocusEvent(gained, oppositePeer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deliverMoveResizeEvent(int x, int y, int width, int height,
|
protected void deliverMoveResizeEvent(int x, int y, int width, int height,
|
||||||
boolean byUser) {
|
boolean byUser) {
|
||||||
// when the content view enters the full-screen mode, the native
|
// when the content view enters the full-screen mode, the native
|
||||||
// move/resize notifications contain a bounds smaller than
|
// move/resize notifications contain a bounds smaller than
|
||||||
@ -916,7 +924,11 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
|
|
||||||
final Rectangle oldB = nativeBounds;
|
final Rectangle oldB = nativeBounds;
|
||||||
nativeBounds = new Rectangle(x, y, width, height);
|
nativeBounds = new Rectangle(x, y, width, height);
|
||||||
|
|
||||||
|
if (peer != null) {
|
||||||
peer.notifyReshape(x, y, width, height);
|
peer.notifyReshape(x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
if ((byUser && !oldB.getSize().equals(nativeBounds.getSize()))
|
if ((byUser && !oldB.getSize().equals(nativeBounds.getSize()))
|
||||||
|| isFullScreenAnimationOn) {
|
|| isFullScreenAnimationOn) {
|
||||||
flushBuffers();
|
flushBuffers();
|
||||||
@ -924,28 +936,40 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void deliverWindowClosingEvent() {
|
private void deliverWindowClosingEvent() {
|
||||||
|
if (peer != null) {
|
||||||
if (peer.getBlocker() == null) {
|
if (peer.getBlocker() == null) {
|
||||||
peer.postEvent(new WindowEvent(target, WindowEvent.WINDOW_CLOSING));
|
peer.postEvent(new WindowEvent(target, WindowEvent.WINDOW_CLOSING));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void deliverIconify(final boolean iconify) {
|
private void deliverIconify(final boolean iconify) {
|
||||||
|
if (peer != null) {
|
||||||
peer.notifyIconify(iconify);
|
peer.notifyIconify(iconify);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void deliverZoom(final boolean isZoomed) {
|
private void deliverZoom(final boolean isZoomed) {
|
||||||
|
if (peer != null) {
|
||||||
peer.notifyZoom(isZoomed);
|
peer.notifyZoom(isZoomed);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void deliverNCMouseDown() {
|
private void deliverNCMouseDown() {
|
||||||
|
if (peer != null) {
|
||||||
peer.notifyNCMouseDown();
|
peer.notifyNCMouseDown();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Our focus model is synthetic and only non-simple window
|
* Our focus model is synthetic and only non-simple window
|
||||||
* may become natively focusable window.
|
* may become natively focusable window.
|
||||||
*/
|
*/
|
||||||
private boolean isNativelyFocusableWindow() {
|
private boolean isNativelyFocusableWindow() {
|
||||||
|
if (peer == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return !peer.isSimpleWindow() && target.getFocusableWindowState();
|
return !peer.isSimpleWindow() && target.getFocusableWindowState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -960,7 +984,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkBlocking() {
|
private boolean checkBlocking() {
|
||||||
LWWindowPeer blocker = peer.getBlocker();
|
LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
|
||||||
if (blocker == null) {
|
if (blocker == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
package sun.lwawt.macosx;
|
package sun.lwawt.macosx;
|
||||||
|
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
import sun.lwawt.macosx.event.NSEvent;
|
import sun.lwawt.macosx.event.NSEvent;
|
||||||
|
|
||||||
@ -339,6 +340,9 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
|
|||||||
|
|
||||||
dialog.addWindowListener(handler);
|
dialog.addWindowListener(handler);
|
||||||
|
|
||||||
|
// suppress security warning for untrusted windows
|
||||||
|
AWTAccessor.getWindowAccessor().setTrayIconWindow(dialog, true);
|
||||||
|
|
||||||
dialog.pack();
|
dialog.pack();
|
||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -200,6 +200,11 @@ public class CViewPlatformEmbeddedFrame implements PlatformWindow {
|
|||||||
public void exitFullScreenMode() {
|
public void exitFullScreenMode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFullScreenMode() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWindowState(int windowState) {
|
public void setWindowState(int windowState) {
|
||||||
}
|
}
|
||||||
|
444
jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
Normal file
@ -0,0 +1,444 @@
|
|||||||
|
/*
|
||||||
|
* 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.macosx;
|
||||||
|
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
|
import sun.awt.IconInfo;
|
||||||
|
import sun.awt.SunToolkit;
|
||||||
|
import sun.java2d.SunGraphics2D;
|
||||||
|
import sun.java2d.SurfaceData;
|
||||||
|
import sun.java2d.opengl.CGLLayer;
|
||||||
|
import sun.lwawt.LWWindowPeer;
|
||||||
|
import sun.lwawt.PlatformEventNotifier;
|
||||||
|
import sun.lwawt.SecurityWarningWindow;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.geom.Point2D;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public final class CWarningWindow extends CPlatformWindow
|
||||||
|
implements SecurityWarningWindow, PlatformEventNotifier {
|
||||||
|
|
||||||
|
private static class Lock {};
|
||||||
|
private final Lock lock = new Lock();
|
||||||
|
|
||||||
|
private final static int SHOWING_DELAY = 300;
|
||||||
|
private final static int HIDING_DELAY = 2000;
|
||||||
|
|
||||||
|
private Rectangle bounds = new Rectangle();
|
||||||
|
private final WeakReference<LWWindowPeer> ownerPeer;
|
||||||
|
private final Window ownerWindow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animation stage.
|
||||||
|
*/
|
||||||
|
private volatile int currentIcon = 0;
|
||||||
|
|
||||||
|
/* -1 - uninitialized.
|
||||||
|
* 0 - 16x16
|
||||||
|
* 1 - 24x24
|
||||||
|
* 2 - 32x32
|
||||||
|
* 3 - 48x48
|
||||||
|
*/
|
||||||
|
private int currentSize = -1;
|
||||||
|
private static IconInfo[][] icons;
|
||||||
|
private static IconInfo getSecurityIconInfo(int size, int num) {
|
||||||
|
synchronized (CWarningWindow.class) {
|
||||||
|
if (icons == null) {
|
||||||
|
icons = new IconInfo[4][3];
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int sizeIndex = size % icons.length;
|
||||||
|
return icons[sizeIndex][num % icons[sizeIndex].length];
|
||||||
|
}
|
||||||
|
|
||||||
|
public CWarningWindow(final Window _ownerWindow, final LWWindowPeer _ownerPeer) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.ownerPeer = new WeakReference<LWWindowPeer>(_ownerPeer);
|
||||||
|
this.ownerWindow = _ownerWindow;
|
||||||
|
|
||||||
|
initialize(null, null, _ownerPeer.getPlatformWindow());
|
||||||
|
|
||||||
|
setOpaque(false);
|
||||||
|
|
||||||
|
String warningString = ownerWindow.getWarningString();
|
||||||
|
if (warningString != null) {
|
||||||
|
contentView.setToolTip(ownerWindow.getWarningString());
|
||||||
|
}
|
||||||
|
|
||||||
|
updateIconSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param x,y,w,h coordinates of the untrusted window
|
||||||
|
*/
|
||||||
|
public void reposition(int x, int y, int w, int h) {
|
||||||
|
final Point2D point = AWTAccessor.getWindowAccessor().
|
||||||
|
calculateSecurityWarningPosition(ownerWindow, x, y, w, h);
|
||||||
|
setBounds((int)point.getX(), (int)point.getY(), getWidth(), getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisible(boolean visible, boolean doSchedule) {
|
||||||
|
synchronized (scheduler) {
|
||||||
|
if (showingTaskHandle != null) {
|
||||||
|
showingTaskHandle.cancel(false);
|
||||||
|
showingTaskHandle = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hidingTaskHandle != null) {
|
||||||
|
hidingTaskHandle.cancel(false);
|
||||||
|
hidingTaskHandle = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visible) {
|
||||||
|
if (isVisible()) {
|
||||||
|
currentIcon = 0;
|
||||||
|
} else {
|
||||||
|
currentIcon = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
showingTaskHandle = scheduler.schedule(showingTask, 50,
|
||||||
|
TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (!isVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doSchedule) {
|
||||||
|
hidingTaskHandle = scheduler.schedule(hidingTask, HIDING_DELAY,
|
||||||
|
TimeUnit.MILLISECONDS);
|
||||||
|
} else {
|
||||||
|
hidingTaskHandle = scheduler.schedule(hidingTask, 50,
|
||||||
|
TimeUnit.MILLISECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyIconify(boolean iconify) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyZoom(boolean isZoomed) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyExpose(final Rectangle r) {
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyReshape(int x, int y, int w, int h) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyUpdateCursor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyActivation(boolean activation, LWWindowPeer opposite) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyNCMouseDown() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
LWWindowPeer peer = ownerPeer.get();
|
||||||
|
if (id == MouseEvent.MOUSE_EXITED) {
|
||||||
|
if (peer != null) {
|
||||||
|
peer.updateSecurityWarningVisibility();
|
||||||
|
}
|
||||||
|
} else if(id == MouseEvent.MOUSE_ENTERED) {
|
||||||
|
if (peer != null) {
|
||||||
|
peer.updateSecurityWarningVisibility();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rectangle getBounds() {
|
||||||
|
synchronized (lock) {
|
||||||
|
return bounds.getBounds();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible() {
|
||||||
|
synchronized (lock) {
|
||||||
|
return visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setVisible(boolean visible) {
|
||||||
|
synchronized (lock) {
|
||||||
|
final long nsWindowPtr = getNSWindowPtr();
|
||||||
|
|
||||||
|
// Process parent-child relationship when hiding
|
||||||
|
if (!visible) {
|
||||||
|
// Unparent myself
|
||||||
|
if (owner != null && owner.isVisible()) {
|
||||||
|
CWrapper.NSWindow.removeChildWindow(
|
||||||
|
owner.getNSWindowPtr(), nsWindowPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actually show or hide the window
|
||||||
|
if (visible) {
|
||||||
|
CWrapper.NSWindow.orderFront(nsWindowPtr);
|
||||||
|
} else {
|
||||||
|
CWrapper.NSWindow.orderOut(nsWindowPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.visible = visible;
|
||||||
|
|
||||||
|
// Manage parent-child relationship when showing
|
||||||
|
if (visible) {
|
||||||
|
// Add myself as a child
|
||||||
|
if (owner != null && owner.isVisible()) {
|
||||||
|
CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(),
|
||||||
|
nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
|
||||||
|
|
||||||
|
// do not allow security warning to be obscured by other windows
|
||||||
|
if (ownerWindow.isAlwaysOnTop()) {
|
||||||
|
CWrapper.NSWindow.setLevel(nsWindowPtr,
|
||||||
|
CWrapper.NSWindow.NSFloatingWindowLevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
|
||||||
|
int scrollType, int scrollAmount,
|
||||||
|
int wheelRotation, double preciseWheelRotation,
|
||||||
|
byte[] bdata) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyKeyEvent(int id, long when, int modifiers, int keyCode,
|
||||||
|
char keyChar, int keyLocation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getInitialStyleBits() {
|
||||||
|
int styleBits = 0;
|
||||||
|
CPlatformWindow.SET(styleBits, CPlatformWindow.UTILITY, true);
|
||||||
|
return styleBits;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void deliverMoveResizeEvent(int x, int y, int width, int height,
|
||||||
|
boolean byUser) {
|
||||||
|
|
||||||
|
boolean isResize;
|
||||||
|
synchronized (lock) {
|
||||||
|
isResize = (bounds.width != width || bounds.height != height);
|
||||||
|
bounds = new Rectangle(x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isResize) {
|
||||||
|
replaceSurface();
|
||||||
|
}
|
||||||
|
|
||||||
|
super.deliverMoveResizeEvent(x, y, width, height, byUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CPlatformResponder createPlatformResponder() {
|
||||||
|
return new CPlatformResponder(this, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CPlatformView createContentView() {
|
||||||
|
return new CPlatformView() {
|
||||||
|
public GraphicsConfiguration getGraphicsConfiguration() {
|
||||||
|
LWWindowPeer peer = ownerPeer.get();
|
||||||
|
return peer.getGraphicsConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rectangle getBounds() {
|
||||||
|
return CWarningWindow.this.getBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CGLLayer createCGLayer() {
|
||||||
|
return new CGLLayer(null) {
|
||||||
|
public Rectangle getBounds() {
|
||||||
|
return CWarningWindow.this.getBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GraphicsConfiguration getGraphicsConfiguration() {
|
||||||
|
LWWindowPeer peer = ownerPeer.get();
|
||||||
|
return peer.getGraphicsConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOpaque() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateIconSize() {
|
||||||
|
int newSize = -1;
|
||||||
|
|
||||||
|
if (ownerWindow != null) {
|
||||||
|
Insets insets = ownerWindow.getInsets();
|
||||||
|
int max = Math.max(insets.top, Math.max(insets.bottom,
|
||||||
|
Math.max(insets.left, insets.right)));
|
||||||
|
if (max < 24) {
|
||||||
|
newSize = 0;
|
||||||
|
} else if (max < 32) {
|
||||||
|
newSize = 1;
|
||||||
|
} else if (max < 48) {
|
||||||
|
newSize = 2;
|
||||||
|
} else {
|
||||||
|
newSize = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Make sure we have a valid size
|
||||||
|
if (newSize == -1) {
|
||||||
|
newSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized (lock) {
|
||||||
|
if (newSize != currentSize) {
|
||||||
|
currentSize = newSize;
|
||||||
|
IconInfo ico = getSecurityIconInfo(currentSize, 0);
|
||||||
|
AWTAccessor.getWindowAccessor().setSecurityWarningSize(
|
||||||
|
ownerWindow, ico.getWidth(), ico.getHeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Graphics getGraphics() {
|
||||||
|
SurfaceData sd = contentView.getSurfaceData();
|
||||||
|
if (ownerWindow == null || sd == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return transformGraphics(new SunGraphics2D(sd, SystemColor.windowText,
|
||||||
|
SystemColor.window, ownerWindow.getFont()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void repaint() {
|
||||||
|
final Graphics g = getGraphics();
|
||||||
|
if (g != null) {
|
||||||
|
try {
|
||||||
|
((Graphics2D) g).setComposite(AlphaComposite.Src);
|
||||||
|
g.drawImage(getSecurityIconInfo().getImage(), 0, 0, null);
|
||||||
|
} finally {
|
||||||
|
g.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void replaceSurface() {
|
||||||
|
SurfaceData oldData = contentView.getSurfaceData();
|
||||||
|
|
||||||
|
replaceSurfaceData();
|
||||||
|
|
||||||
|
if (oldData != null && oldData != contentView.getSurfaceData()) {
|
||||||
|
oldData.flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getWidth() {
|
||||||
|
return getSecurityIconInfo().getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getHeight() {
|
||||||
|
return getSecurityIconInfo().getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
private IconInfo getSecurityIconInfo() {
|
||||||
|
return getSecurityIconInfo(currentSize, currentIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Runnable hidingTask = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
synchronized (lock) {
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized (scheduler) {
|
||||||
|
hidingTaskHandle = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private final Runnable showingTask = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
synchronized (lock) {
|
||||||
|
if (!isVisible()) {
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized (scheduler) {
|
||||||
|
if (currentIcon > 0) {
|
||||||
|
currentIcon--;
|
||||||
|
showingTaskHandle = scheduler.schedule(showingTask, SHOWING_DELAY,
|
||||||
|
TimeUnit.MILLISECONDS);
|
||||||
|
} else {
|
||||||
|
showingTaskHandle = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private final ScheduledExecutorService scheduler =
|
||||||
|
Executors.newSingleThreadScheduledExecutor();
|
||||||
|
|
||||||
|
private ScheduledFuture hidingTaskHandle;
|
||||||
|
private ScheduledFuture showingTaskHandle;
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -87,6 +87,8 @@ public final class CWrapper {
|
|||||||
public static native void exitFullScreenMode(long view);
|
public static native void exitFullScreenMode(long view);
|
||||||
|
|
||||||
public static native void setHidden(long view, boolean hidden);
|
public static native void setHidden(long view, boolean hidden);
|
||||||
|
|
||||||
|
public static native void setToolTip(long view, String msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class NSObject {
|
public static final class NSObject {
|
||||||
|
@ -166,6 +166,11 @@ public final class LWCToolkit extends LWToolkit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer) {
|
||||||
|
return new CWarningWindow(ownerWindow, ownerPeer);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PlatformComponent createPlatformComponent() {
|
protected PlatformComponent createPlatformComponent() {
|
||||||
return new CPlatformComponent();
|
return new CPlatformComponent();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -669,6 +669,27 @@ Java_sun_lwawt_macosx_CWrapper_00024NSView_setHidden
|
|||||||
JNF_COCOA_EXIT(env);
|
JNF_COCOA_EXIT(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||||
|
[view setToolTip: s];
|
||||||
|
}];
|
||||||
|
|
||||||
|
JNF_COCOA_EXIT(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: sun_lwawt_macosx_CWrapper$NSScreen
|
* Class: sun_lwawt_macosx_CWrapper$NSScreen
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -22,7 +22,7 @@
|
|||||||
* or visit www.oracle.com if you need additional information or have any
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
package sun.awt.X11;
|
package sun.awt;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.color.*;
|
import java.awt.color.*;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
||||||
@ -30,17 +30,17 @@ import sun.awt.image.ToolkitImage;
|
|||||||
import sun.awt.image.ImageRepresentation;
|
import sun.awt.image.ImageRepresentation;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
class XIconInfo {
|
public class IconInfo {
|
||||||
/**
|
/**
|
||||||
* Representation of image as an int array
|
* Representation of image as an int array.
|
||||||
* It's being used for _NET_WM_ICON hint
|
* It's used on platforms where icon data
|
||||||
* with 32-bit X data model
|
* is expected to be in 32-bit format.
|
||||||
*/
|
*/
|
||||||
private int[] intIconData;
|
private int[] intIconData;
|
||||||
/**
|
/**
|
||||||
* Representation of image as an int array
|
* Representation of image as an long array.
|
||||||
* It's being used for _NET_WM_ICON hint
|
* It's used on platforms where icon data
|
||||||
* with 64-bit X data model
|
* is expected to be in 64-bit format.
|
||||||
*/
|
*/
|
||||||
private long[] longIconData;
|
private long[] longIconData;
|
||||||
/**
|
/**
|
||||||
@ -68,7 +68,7 @@ class XIconInfo {
|
|||||||
*/
|
*/
|
||||||
private int rawLength;
|
private int rawLength;
|
||||||
|
|
||||||
XIconInfo(int[] intIconData) {
|
public IconInfo(int[] intIconData) {
|
||||||
this.intIconData =
|
this.intIconData =
|
||||||
(null == intIconData) ? null : Arrays.copyOf(intIconData, intIconData.length);
|
(null == intIconData) ? null : Arrays.copyOf(intIconData, intIconData.length);
|
||||||
this.width = intIconData[0];
|
this.width = intIconData[0];
|
||||||
@ -78,7 +78,7 @@ class XIconInfo {
|
|||||||
this.rawLength = width * height + 2;
|
this.rawLength = width * height + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
XIconInfo(long[] longIconData) {
|
public IconInfo(long[] longIconData) {
|
||||||
this.longIconData =
|
this.longIconData =
|
||||||
(null == longIconData) ? null : Arrays.copyOf(longIconData, longIconData.length);
|
(null == longIconData) ? null : Arrays.copyOf(longIconData, longIconData.length);
|
||||||
this.width = (int)longIconData[0];
|
this.width = (int)longIconData[0];
|
||||||
@ -88,7 +88,7 @@ class XIconInfo {
|
|||||||
this.rawLength = width * height + 2;
|
this.rawLength = width * height + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
XIconInfo(Image image) {
|
public IconInfo(Image image) {
|
||||||
this.image = image;
|
this.image = image;
|
||||||
if (image instanceof ToolkitImage) {
|
if (image instanceof ToolkitImage) {
|
||||||
ImageRepresentation ir = ((ToolkitImage)image).getImageRep();
|
ImageRepresentation ir = ((ToolkitImage)image).getImageRep();
|
||||||
@ -107,33 +107,33 @@ class XIconInfo {
|
|||||||
/*
|
/*
|
||||||
* It sets size of scaled icon.
|
* It sets size of scaled icon.
|
||||||
*/
|
*/
|
||||||
void setScaledSize(int width, int height) {
|
public void setScaledSize(int width, int height) {
|
||||||
this.scaledWidth = width;
|
this.scaledWidth = width;
|
||||||
this.scaledHeight = height;
|
this.scaledHeight = height;
|
||||||
this.rawLength = width * height + 2;
|
this.rawLength = width * height + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isValid() {
|
public boolean isValid() {
|
||||||
return (width > 0 && height > 0);
|
return (width > 0 && height > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getWidth() {
|
public int getWidth() {
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getHeight() {
|
public int getHeight() {
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "XIconInfo[w=" + width + ",h=" + height + ",sw=" + scaledWidth + ",sh=" + scaledHeight + "]";
|
return "IconInfo[w=" + width + ",h=" + height + ",sw=" + scaledWidth + ",sh=" + scaledHeight + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
int getRawLength() {
|
public int getRawLength() {
|
||||||
return rawLength;
|
return rawLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] getIntData() {
|
public int[] getIntData() {
|
||||||
if (this.intIconData == null) {
|
if (this.intIconData == null) {
|
||||||
if (this.longIconData != null) {
|
if (this.longIconData != null) {
|
||||||
this.intIconData = longArrayToIntArray(longIconData);
|
this.intIconData = longArrayToIntArray(longIconData);
|
||||||
@ -144,7 +144,7 @@ class XIconInfo {
|
|||||||
return this.intIconData;
|
return this.intIconData;
|
||||||
}
|
}
|
||||||
|
|
||||||
long[] getLongData() {
|
public long[] getLongData() {
|
||||||
if (this.longIconData == null) {
|
if (this.longIconData == null) {
|
||||||
if (this.intIconData != null) {
|
if (this.intIconData != null) {
|
||||||
this.longIconData = intArrayToLongArray(this.intIconData);
|
this.longIconData = intArrayToLongArray(this.intIconData);
|
||||||
@ -156,7 +156,7 @@ class XIconInfo {
|
|||||||
return this.longIconData;
|
return this.longIconData;
|
||||||
}
|
}
|
||||||
|
|
||||||
Image getImage() {
|
public Image getImage() {
|
||||||
if (this.image == null) {
|
if (this.image == null) {
|
||||||
if (this.intIconData != null) {
|
if (this.intIconData != null) {
|
||||||
this.image = intArrayToImage(this.intIconData);
|
this.image = intArrayToImage(this.intIconData);
|
Before Width: | Height: | Size: 463 B After Width: | Height: | Size: 463 B |
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 795 B After Width: | Height: | Size: 795 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 489 B |
Before Width: | Height: | Size: 741 B After Width: | Height: | Size: 741 B |
Before Width: | Height: | Size: 871 B After Width: | Height: | Size: 871 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 477 B After Width: | Height: | Size: 477 B |
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 749 B |
Before Width: | Height: | Size: 866 B After Width: | Height: | Size: 866 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -30,6 +30,7 @@ import java.awt.event.ComponentEvent;
|
|||||||
import java.awt.event.InvocationEvent;
|
import java.awt.event.InvocationEvent;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
|
||||||
|
import sun.awt.IconInfo;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
|
||||||
import sun.awt.AWTAccessor;
|
import sun.awt.AWTAccessor;
|
||||||
@ -106,7 +107,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
focusProxy = createFocusProxy();
|
focusProxy = createFocusProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setIconHints(java.util.List<XIconInfo> icons) {
|
void setIconHints(java.util.List<IconInfo> icons) {
|
||||||
if (!XWM.getWM().setNetWMIcon(this, icons)) {
|
if (!XWM.getWM().setNetWMIcon(this, icons)) {
|
||||||
if (icons.size() > 0) {
|
if (icons.size() > 0) {
|
||||||
if (iconWindow == null) {
|
if (iconWindow == null) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,7 +26,8 @@ package sun.awt.X11;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
||||||
import sun.awt.X11GraphicsConfig;
|
|
||||||
|
import sun.awt.IconInfo;
|
||||||
import sun.awt.image.ToolkitImage;
|
import sun.awt.image.ToolkitImage;
|
||||||
import sun.awt.image.ImageRepresentation;
|
import sun.awt.image.ImageRepresentation;
|
||||||
|
|
||||||
@ -398,12 +399,12 @@ public class XIconWindow extends XBaseWindow {
|
|||||||
* Sets icon image by selecting one of the images from the list.
|
* Sets icon image by selecting one of the images from the list.
|
||||||
* The selected image is the one having the best matching size.
|
* 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;
|
if (icons == null || icons.size() == 0) return;
|
||||||
|
|
||||||
int minDiff = Integer.MAX_VALUE;
|
int minDiff = Integer.MAX_VALUE;
|
||||||
Image min = null;
|
Image min = null;
|
||||||
for (XIconInfo iconInfo : icons) {
|
for (IconInfo iconInfo : icons) {
|
||||||
if (iconInfo.isValid()) {
|
if (iconInfo.isValid()) {
|
||||||
Image image = iconInfo.getImage();
|
Image image = iconInfo.getImage();
|
||||||
Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null));
|
Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,6 +27,8 @@
|
|||||||
package sun.awt.X11;
|
package sun.awt.X11;
|
||||||
|
|
||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
|
|
||||||
|
import sun.awt.IconInfo;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
|
||||||
final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProtocol
|
final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProtocol
|
||||||
@ -350,10 +352,10 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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;
|
if (window == null) return;
|
||||||
|
|
||||||
XAtom iconsAtom = XAtom.get("_NET_WM_ICON");
|
XAtom iconsAtom = XAtom.get("_NET_WM_ICON");
|
||||||
@ -363,7 +365,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
|||||||
}
|
}
|
||||||
|
|
||||||
int length = 0;
|
int length = 0;
|
||||||
for (XIconInfo ii : icons) {
|
for (IconInfo ii : icons) {
|
||||||
length += ii.getRawLength();
|
length += ii.getRawLength();
|
||||||
}
|
}
|
||||||
int cardinalSize = (XlibWrapper.dataModel == 32) ? 4 : 8;
|
int cardinalSize = (XlibWrapper.dataModel == 32) ? 4 : 8;
|
||||||
@ -373,7 +375,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
|||||||
long buffer = XlibWrapper.unsafe.allocateMemory(bufferSize);
|
long buffer = XlibWrapper.unsafe.allocateMemory(bufferSize);
|
||||||
try {
|
try {
|
||||||
long ptr = buffer;
|
long ptr = buffer;
|
||||||
for (XIconInfo ii : icons) {
|
for (IconInfo ii : icons) {
|
||||||
int size = ii.getRawLength() * cardinalSize;
|
int size = ii.getRawLength() * cardinalSize;
|
||||||
if (XlibWrapper.dataModel == 32) {
|
if (XlibWrapper.dataModel == 32) {
|
||||||
XlibWrapper.copyIntArray(ptr, ii.getIntData(), size);
|
XlibWrapper.copyIntArray(ptr, ii.getIntData(), size);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -30,6 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
package sun.awt.X11;
|
package sun.awt.X11;
|
||||||
|
|
||||||
|
import sun.awt.IconInfo;
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
@ -1670,7 +1671,7 @@ final class XWM
|
|||||||
*
|
*
|
||||||
* @return true if hint was modified successfully, false otherwise
|
* @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()) {
|
if (g_net_protocol != null && g_net_protocol.active()) {
|
||||||
g_net_protocol.setWMIcons(window, icons);
|
g_net_protocol.setWMIcons(window, icons);
|
||||||
return getWMID() != ICE_WM;
|
return getWMID() != ICE_WM;
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,11 +25,10 @@
|
|||||||
package sun.awt.X11;
|
package sun.awt.X11;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.lang.ref.WeakReference;
|
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.AWTAccessor;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
|
|
||||||
@ -56,37 +55,37 @@ class XWarningWindow extends XWindow {
|
|||||||
* 3 - 48x48
|
* 3 - 48x48
|
||||||
*/
|
*/
|
||||||
private int currentSize = -1;
|
private int currentSize = -1;
|
||||||
private static XIconInfo[][] icons;
|
private static IconInfo[][] icons;
|
||||||
private static XIconInfo getSecurityIconInfo(int size, int num) {
|
private static IconInfo getSecurityIconInfo(int size, int num) {
|
||||||
synchronized (XWarningWindow.class) {
|
synchronized (XWarningWindow.class) {
|
||||||
if (icons == null) {
|
if (icons == null) {
|
||||||
icons = new XIconInfo[4][3];
|
icons = new IconInfo[4][3];
|
||||||
if (XlibWrapper.dataModel == 32) {
|
if (XlibWrapper.dataModel == 32) {
|
||||||
icons[0][0] = new XIconInfo(XAWTIcon32_security_icon_bw16_png.security_icon_bw16_png);
|
icons[0][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw16_png.security_icon_bw16_png);
|
||||||
icons[0][1] = new XIconInfo(XAWTIcon32_security_icon_interim16_png.security_icon_interim16_png);
|
icons[0][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim16_png.security_icon_interim16_png);
|
||||||
icons[0][2] = new XIconInfo(XAWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png);
|
icons[0][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png);
|
||||||
icons[1][0] = new XIconInfo(XAWTIcon32_security_icon_bw24_png.security_icon_bw24_png);
|
icons[1][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw24_png.security_icon_bw24_png);
|
||||||
icons[1][1] = new XIconInfo(XAWTIcon32_security_icon_interim24_png.security_icon_interim24_png);
|
icons[1][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim24_png.security_icon_interim24_png);
|
||||||
icons[1][2] = new XIconInfo(XAWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png);
|
icons[1][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png);
|
||||||
icons[2][0] = new XIconInfo(XAWTIcon32_security_icon_bw32_png.security_icon_bw32_png);
|
icons[2][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw32_png.security_icon_bw32_png);
|
||||||
icons[2][1] = new XIconInfo(XAWTIcon32_security_icon_interim32_png.security_icon_interim32_png);
|
icons[2][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim32_png.security_icon_interim32_png);
|
||||||
icons[2][2] = new XIconInfo(XAWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png);
|
icons[2][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png);
|
||||||
icons[3][0] = new XIconInfo(XAWTIcon32_security_icon_bw48_png.security_icon_bw48_png);
|
icons[3][0] = new IconInfo(sun.awt.AWTIcon32_security_icon_bw48_png.security_icon_bw48_png);
|
||||||
icons[3][1] = new XIconInfo(XAWTIcon32_security_icon_interim48_png.security_icon_interim48_png);
|
icons[3][1] = new IconInfo(sun.awt.AWTIcon32_security_icon_interim48_png.security_icon_interim48_png);
|
||||||
icons[3][2] = new XIconInfo(XAWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png);
|
icons[3][2] = new IconInfo(sun.awt.AWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png);
|
||||||
} else {
|
} else {
|
||||||
icons[0][0] = new XIconInfo(XAWTIcon64_security_icon_bw16_png.security_icon_bw16_png);
|
icons[0][0] = new IconInfo(sun.awt.AWTIcon64_security_icon_bw16_png.security_icon_bw16_png);
|
||||||
icons[0][1] = new XIconInfo(XAWTIcon64_security_icon_interim16_png.security_icon_interim16_png);
|
icons[0][1] = new IconInfo(sun.awt.AWTIcon64_security_icon_interim16_png.security_icon_interim16_png);
|
||||||
icons[0][2] = new XIconInfo(XAWTIcon64_security_icon_yellow16_png.security_icon_yellow16_png);
|
icons[0][2] = new IconInfo(sun.awt.AWTIcon64_security_icon_yellow16_png.security_icon_yellow16_png);
|
||||||
icons[1][0] = new XIconInfo(XAWTIcon64_security_icon_bw24_png.security_icon_bw24_png);
|
icons[1][0] = new IconInfo(sun.awt.AWTIcon64_security_icon_bw24_png.security_icon_bw24_png);
|
||||||
icons[1][1] = new XIconInfo(XAWTIcon64_security_icon_interim24_png.security_icon_interim24_png);
|
icons[1][1] = new IconInfo(sun.awt.AWTIcon64_security_icon_interim24_png.security_icon_interim24_png);
|
||||||
icons[1][2] = new XIconInfo(XAWTIcon64_security_icon_yellow24_png.security_icon_yellow24_png);
|
icons[1][2] = new IconInfo(sun.awt.AWTIcon64_security_icon_yellow24_png.security_icon_yellow24_png);
|
||||||
icons[2][0] = new XIconInfo(XAWTIcon64_security_icon_bw32_png.security_icon_bw32_png);
|
icons[2][0] = new IconInfo(sun.awt.AWTIcon64_security_icon_bw32_png.security_icon_bw32_png);
|
||||||
icons[2][1] = new XIconInfo(XAWTIcon64_security_icon_interim32_png.security_icon_interim32_png);
|
icons[2][1] = new IconInfo(sun.awt.AWTIcon64_security_icon_interim32_png.security_icon_interim32_png);
|
||||||
icons[2][2] = new XIconInfo(XAWTIcon64_security_icon_yellow32_png.security_icon_yellow32_png);
|
icons[2][2] = new IconInfo(sun.awt.AWTIcon64_security_icon_yellow32_png.security_icon_yellow32_png);
|
||||||
icons[3][0] = new XIconInfo(XAWTIcon64_security_icon_bw48_png.security_icon_bw48_png);
|
icons[3][0] = new IconInfo(sun.awt.AWTIcon64_security_icon_bw48_png.security_icon_bw48_png);
|
||||||
icons[3][1] = new XIconInfo(XAWTIcon64_security_icon_interim48_png.security_icon_interim48_png);
|
icons[3][1] = new IconInfo(sun.awt.AWTIcon64_security_icon_interim48_png.security_icon_interim48_png);
|
||||||
icons[3][2] = new XIconInfo(XAWTIcon64_security_icon_yellow48_png.security_icon_yellow48_png);
|
icons[3][2] = new IconInfo(sun.awt.AWTIcon64_security_icon_yellow48_png.security_icon_yellow48_png);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +124,7 @@ class XWarningWindow extends XWindow {
|
|||||||
try {
|
try {
|
||||||
if (newSize != currentSize) {
|
if (newSize != currentSize) {
|
||||||
currentSize = newSize;
|
currentSize = newSize;
|
||||||
XIconInfo ico = getSecurityIconInfo(currentSize, 0);
|
IconInfo ico = getSecurityIconInfo(currentSize, 0);
|
||||||
XlibWrapper.SetBitmapShape(XToolkit.getDisplay(), getWindow(),
|
XlibWrapper.SetBitmapShape(XToolkit.getDisplay(), getWindow(),
|
||||||
ico.getWidth(), ico.getHeight(), ico.getIntData());
|
ico.getWidth(), ico.getHeight(), ico.getIntData());
|
||||||
AWTAccessor.getWindowAccessor().setSecurityWarningSize(
|
AWTAccessor.getWindowAccessor().setSecurityWarningSize(
|
||||||
@ -136,7 +135,7 @@ class XWarningWindow extends XWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private XIconInfo getSecurityIconInfo() {
|
private IconInfo getSecurityIconInfo() {
|
||||||
updateIconSize();
|
updateIconSize();
|
||||||
return getSecurityIconInfo(currentSize, currentIcon);
|
return getSecurityIconInfo(currentSize, currentIcon);
|
||||||
}
|
}
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,8 +23,7 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
package sun.awt.X11;
|
package sun.awt.X11;
|
||||||
import java.awt.Image;
|
import sun.awt.IconInfo;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
class XWindowAttributesData {
|
class XWindowAttributesData {
|
||||||
static int NORMAL = 0;
|
static int NORMAL = 0;
|
||||||
@ -51,7 +50,7 @@ class XWindowAttributesData {
|
|||||||
boolean initialResizability;
|
boolean initialResizability;
|
||||||
int visibilityState; // updated by native X11 event handling code.
|
int visibilityState; // updated by native X11 event handling code.
|
||||||
String title;
|
String title;
|
||||||
java.util.List<XIconInfo> icons;
|
java.util.List<IconInfo> icons;
|
||||||
boolean iconsInherited;
|
boolean iconsInherited;
|
||||||
int decorations; // for future expansion to be able to
|
int decorations; // for future expansion to be able to
|
||||||
// specify native decorations
|
// specify native decorations
|
||||||
|
@ -30,8 +30,6 @@ import java.awt.event.ComponentEvent;
|
|||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
|
|
||||||
import java.awt.peer.ComponentPeer;
|
import java.awt.peer.ComponentPeer;
|
||||||
import java.awt.peer.WindowPeer;
|
import java.awt.peer.WindowPeer;
|
||||||
|
|
||||||
@ -55,6 +53,7 @@ import sun.awt.DisplayChangedListener;
|
|||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
import sun.awt.X11GraphicsDevice;
|
import sun.awt.X11GraphicsDevice;
|
||||||
import sun.awt.X11GraphicsEnvironment;
|
import sun.awt.X11GraphicsEnvironment;
|
||||||
|
import sun.awt.IconInfo;
|
||||||
|
|
||||||
import sun.java2d.pipe.Region;
|
import sun.java2d.pipe.Region;
|
||||||
|
|
||||||
@ -292,7 +291,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
|||||||
Window target = (Window)this.target;
|
Window target = (Window)this.target;
|
||||||
java.util.List<Image> iconImages = ((Window)target).getIconImages();
|
java.util.List<Image> iconImages = ((Window)target).getIconImages();
|
||||||
XWindowPeer ownerPeer = getOwnerPeer();
|
XWindowPeer ownerPeer = getOwnerPeer();
|
||||||
winAttr.icons = new ArrayList<XIconInfo>();
|
winAttr.icons = new ArrayList<IconInfo>();
|
||||||
if (iconImages.size() != 0) {
|
if (iconImages.size() != 0) {
|
||||||
//read icon images from target
|
//read icon images from target
|
||||||
winAttr.iconsInherited = false;
|
winAttr.iconsInherited = false;
|
||||||
@ -304,9 +303,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
XIconInfo iconInfo;
|
IconInfo iconInfo;
|
||||||
try {
|
try {
|
||||||
iconInfo = new XIconInfo(image);
|
iconInfo = new IconInfo(image);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
if (log.isLoggable(PlatformLogger.FINEST)) {
|
if (log.isLoggable(PlatformLogger.FINEST)) {
|
||||||
log.finest("XWindowPeer.updateIconImages: Perhaps the image passed into Java is broken. Skipping this icon.");
|
log.finest("XWindowPeer.updateIconImages: Perhaps the image passed into Java is broken. Skipping this icon.");
|
||||||
@ -344,12 +343,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
|||||||
* It does scale some of these icons to appropriate size
|
* It does scale some of these icons to appropriate size
|
||||||
* if it's necessary.
|
* if it's necessary.
|
||||||
*/
|
*/
|
||||||
static java.util.List<XIconInfo> normalizeIconImages(java.util.List<XIconInfo> icons) {
|
static java.util.List<IconInfo> normalizeIconImages(java.util.List<IconInfo> icons) {
|
||||||
java.util.List<XIconInfo> result = new ArrayList<XIconInfo>();
|
java.util.List<IconInfo> result = new ArrayList<IconInfo>();
|
||||||
int totalLength = 0;
|
int totalLength = 0;
|
||||||
boolean haveLargeIcon = false;
|
boolean haveLargeIcon = false;
|
||||||
|
|
||||||
for (XIconInfo icon : icons) {
|
for (IconInfo icon : icons) {
|
||||||
int width = icon.getWidth();
|
int width = icon.getWidth();
|
||||||
int height = icon.getHeight();
|
int height = icon.getHeight();
|
||||||
int length = icon.getRawLength();
|
int length = icon.getRawLength();
|
||||||
@ -390,16 +389,16 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
|||||||
/*
|
/*
|
||||||
* Dumps each icon from the list
|
* 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)) {
|
if (iconLog.isLoggable(PlatformLogger.FINEST)) {
|
||||||
iconLog.finest(">>> Sizes of icon images:");
|
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());
|
iconLog.finest(" {0}", i.next());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recursivelySetIcon(java.util.List<XIconInfo> icons) {
|
public void recursivelySetIcon(java.util.List<IconInfo> icons) {
|
||||||
dumpIcons(winAttr.icons);
|
dumpIcons(winAttr.icons);
|
||||||
setIconHints(icons);
|
setIconHints(icons);
|
||||||
Window target = (Window)this.target;
|
Window target = (Window)this.target;
|
||||||
@ -416,28 +415,28 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
java.util.List<XIconInfo> getIconInfo() {
|
java.util.List<IconInfo> getIconInfo() {
|
||||||
return winAttr.icons;
|
return winAttr.icons;
|
||||||
}
|
}
|
||||||
void setIconHints(java.util.List<XIconInfo> icons) {
|
void setIconHints(java.util.List<IconInfo> icons) {
|
||||||
//This does nothing for XWindowPeer,
|
//This does nothing for XWindowPeer,
|
||||||
//It's overriden in XDecoratedPeer
|
//It's overriden in XDecoratedPeer
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ArrayList<XIconInfo> defaultIconInfo;
|
private static ArrayList<IconInfo> defaultIconInfo;
|
||||||
protected synchronized static java.util.List<XIconInfo> getDefaultIconInfo() {
|
protected synchronized static java.util.List<IconInfo> getDefaultIconInfo() {
|
||||||
if (defaultIconInfo == null) {
|
if (defaultIconInfo == null) {
|
||||||
defaultIconInfo = new ArrayList<XIconInfo>();
|
defaultIconInfo = new ArrayList<IconInfo>();
|
||||||
if (XlibWrapper.dataModel == 32) {
|
if (XlibWrapper.dataModel == 32) {
|
||||||
defaultIconInfo.add(new XIconInfo(XAWTIcon32_java_icon16_png.java_icon16_png));
|
defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon32_java_icon16_png.java_icon16_png));
|
||||||
defaultIconInfo.add(new XIconInfo(XAWTIcon32_java_icon24_png.java_icon24_png));
|
defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon32_java_icon24_png.java_icon24_png));
|
||||||
defaultIconInfo.add(new XIconInfo(XAWTIcon32_java_icon32_png.java_icon32_png));
|
defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon32_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_icon48_png.java_icon48_png));
|
||||||
} else {
|
} else {
|
||||||
defaultIconInfo.add(new XIconInfo(XAWTIcon64_java_icon16_png.java_icon16_png));
|
defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon64_java_icon16_png.java_icon16_png));
|
||||||
defaultIconInfo.add(new XIconInfo(XAWTIcon64_java_icon24_png.java_icon24_png));
|
defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon64_java_icon24_png.java_icon24_png));
|
||||||
defaultIconInfo.add(new XIconInfo(XAWTIcon64_java_icon32_png.java_icon32_png));
|
defaultIconInfo.add(new IconInfo(sun.awt.AWTIcon64_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_icon48_png.java_icon48_png));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return defaultIconInfo;
|
return defaultIconInfo;
|
||||||
|