--- a/jdk/make/Makefile Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/make/Makefile Tue Jan 29 20:19:48 2013 -0800
@@ -237,6 +237,9 @@
ifeq ($(PLATFORM), macosx)
SUBDIRS += apple
endif
+ifeq ($(PLATFORM), windows)
+ SUBDIRS += bridge
+endif
SUBDIRS_tools = launchers
SUBDIRS_misc = org jpda
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/bridge/AccessBridgeJava/Makefile Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,93 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+#
+# Makefile for building AccessBridge
+#
+BUILDDIR = ../..
+PRODUCT = java
+PACKAGE = com.sun.java.accessibility
+
+include $(BUILDDIR)/common/Defs.gmk
+JARFILE = $(EXTDIR)/access-bridge$(ABSUFFIX).jar
+
+ifeq ($(ARCH_DATA_MODEL), 64)
+ ABPLATFORM = 64bit
+ ABSUFFIX = -64
+else
+ifeq ($(ARCH_DATA_MODEL), 32)
+ifdef ABLEGACY
+ ABSUFFIX =
+ ABPLATFORM = legacy
+else
+ ABPLATFORM = 32bit
+ ABSUFFIX = -32
+endif
+endif
+endif
+
+#
+# Java files to compile.
+#
+FILES_java = com/sun/java/accessibility/AccessBridge.java
+
+#
+# Location for the newly built classfiles.
+#
+CLASSDESTDIR = $(TEMPDIR)/classes
+
+#
+# Rules
+#
+CLASSDESTDIR = $(TEMPDIR)/classes
+
+FILES_class = $(FILES_java:%.java=$(CLASSDESTDIR)/%.class)
+
+build: prebuild
+
+prebuild:
+ $(CP) $(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility/$(ABPLATFORM)/AccessBridge.java \
+ $(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility
+
+all : build $(JARFILE)
+
+#
+# JAR file
+#
+$(JARFILE): \
+ $(FILES_class)
+ $(BOOT_JAR_CMD) -cf $(JARFILE) \
+ -C $(CLASSDESTDIR) com \
+ $(BOOT_JAR_JFLAGS)
+ @$(java-vm-cleanup)
+
+#
+# Rules
+#
+include $(BUILDDIR)/common/Classes.gmk
+
+clean clobber::
+ $(RM) -r $(CLASSDESTDIR) \
+ $(EXTDIR)/$(JARFILE)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/bridge/JAWTAccessBridge/Files_cpp.gmk Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,29 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+#
+# Native files to compile.
+FILES_cpp = \
+ JAWTAccessBridge.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/bridge/JAWTAccessBridge/Makefile Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,69 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+#
+# Makefile for building JAWTAccessBridge
+#
+
+BUILDDIR = ../..
+LIBRARY = JAWTAccessBridge$(ABSUFFIX)
+include $(BUILDDIR)/common/Defs.gmk
+
+# Indicate we want the C++ compiler to do the linking.
+CPLUSPLUSLIBRARY=true
+
+ifeq ($(ARCH_DATA_MODEL), 64)
+ ABSUFFIX = -64
+ ACCESSBRIDGE_ARCH = ACCESSBRIDGE_ARCH_64
+ ABRIDGE_MACHINE=X64
+else
+ifeq ($(ARCH_DATA_MODEL), 32)
+ ABRIDGE_MACHINE=I386
+ifdef ABLEGACY
+ ABSUFFIX =
+ ACCESSBRIDGE_ARCH = ACCESSBRIDGE_ARCH_LEGACY
+else
+ ABSUFFIX = -32
+ ACCESSBRIDGE_ARCH = ACCESSBRIDGE_ARCH_32
+endif
+endif
+endif
+
+include FILES_cpp.gmk
+
+VERSIONINFO_RESOURCE = $(CLOSED_PLATFORM_SRC)/native/sun/bridge/AccessBridgeStatusWindow.rc
+
+OTHER_CPPFLAGS += -D$(ACCESSBRIDGE_ARCH) -I "$(INCLUDEDIR)" -I "$(PLATFORM_INCLUDE)"
+LDLIBS += kernel32.lib user32.lib gdi32.lib winspool.lib jawt.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
+ uuid.lib odbc32.lib odbccp32.lib /subsystem:windows /dll /incremental:no /machine:$(ABRIDGE_MACHINE) \
+ /def:$(CLOSED_PLATFORM_SRC)/native/sun/bridge/JAWTAccessBridge.DEF /libpath:"$(LIBDIR)"
+
+#
+# Rules
+#
+include $(BUILDDIR)/common/Library.gmk
+
+vpath %.cpp $(CLOSED_PLATFORM_SRC)/native/sun/bridge
+vpath %.RC $(CLOSED_PLATFORM_SRC)/native/sun/bridge
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/bridge/Jabswitch/Makefile Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,63 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+#
+# Makefile for building jabswitch.exe
+#
+
+BUILDDIR = ../..
+PROGRAM = jabswitch
+include $(BUILDDIR)/common/Defs.gmk
+
+# Indicate we want the C++ compiler to do the linking.
+CPLUSPLUSLIBRARY=true
+
+VERSIONINFO_RESOURCE = $(CLOSED_PLATFORM_SRC)/native/sun/bridge/AccessBridgeStatusWindow.rc
+VERSIONRES = $(TEMPDIR)/AccessBridgeStatusWindow.res
+
+JAB_EXE= $(TEMPDIR)/jabswitch.exe
+
+JAB_SRC = $(CLOSED_PLATFORM_SRC)/native/sun/bridge/jabswitch.cpp
+
+JAB_MANIFEST_INP = $(CLOSED_PLATFORM_SRC)/native/sun/bridge/jabswitch.manifest
+JAB_MANIFEST_OUT = $(TEMPDIR)/jabswitch.exe.intermediate.manifest
+
+RC_FLAGS += /fo "$(VERSIONRES)"
+OTHER_CPPFLAGS += /MD /Fo"$(TEMPDIR)/" /Fd"$(TEMPDIR)/" /analyze- /Od /Gd /nologo /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /RTC1 /W3 /ZI /Zc:wchar_t /EHsc
+LDDFLAGS += Advapi32.lib Version.lib User32.lib
+
+all: buildexe copyfilejab
+
+buildexe :
+ $(CD) $(TEMPDIR)
+ $(RC) $(RC_FLAGS) $(VERSIONINFO_RESOURCE)
+ $(CC) $(CPPFLAGS) $(JAB_SRC) $(LDDFLAGS) $(VERSIONRES) -o $(JAB_EXE)
+ $(MT) /nologo /verbose /manifest $(JAB_MANIFEST_INP) /outputresource:$(JAB_EXE)
+
+copyfilejab :
+ $(CP) $(JAB_EXE) $(BINDIR)
+
+vpath %.cpp $(CLOSED_PLATFORM_SRC)/native/sun/bridge
+vpath %.rc $(CLOSED_PLATFORM_SRC)/native/sun/bridge
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/bridge/Jaccess/Makefile Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,85 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+#
+# Makefile for building jaccess
+#
+BUILDDIR = ../..
+PRODUCT = java
+PACKAGE = com.sun.java.accessibility.jaccess
+
+include $(BUILDDIR)/common/Defs.gmk
+JARFILE = $(EXTDIR)/jaccess.jar
+
+#
+# Java files to compile.
+#
+#AUTO_FILES_JAVA_DIRS = $(CLOSED_PLATFORM_SRC)/bridge
+FILES_java = \
+ com/sun/java/accessibility/util/AccessibilityEventMonitor.java \
+ com/sun/java/accessibility/util/AccessibilityListenerList.java \
+ com/sun/java/accessibility/util/AWTEventMonitor.java \
+ com/sun/java/accessibility/util/EventID.java \
+ com/sun/java/accessibility/util/EventQueueMonitor.java \
+ com/sun/java/accessibility/util/GUIInitializedListener.java \
+ com/sun/java/accessibility/util/GUIInitializedMulticaster.java \
+ com/sun/java/accessibility/util/SwingEventMonitor.java \
+ com/sun/java/accessibility/util/TopLevelWindowListener.java \
+ com/sun/java/accessibility/util/TopLevelWindowMulticaster.java \
+ com/sun/java/accessibility/util/Translator.java \
+ com/sun/java/accessibility/util/java/awt/ButtonTranslator.java \
+ com/sun/java/accessibility/util/java/awt/CheckboxTranslator.java \
+ com/sun/java/accessibility/util/java/awt/LabelTranslator.java \
+ com/sun/java/accessibility/util/java/awt/ListTranslator.java \
+ com/sun/java/accessibility/util/java/awt/TextComponentTranslator.java
+
+#
+# Rules
+#
+CLASSDESTDIR = $(TEMPDIR)/classes
+
+FILES_class = $(FILES_java:%.java=$(CLASSDESTDIR)/%.class)
+
+all : build $(JARFILE)
+
+#
+# JAR file
+#
+$(JARFILE): \
+ $(FILES_class)
+ $(BOOT_JAR_CMD) -cf $(JARFILE) \
+ -C $(CLASSDESTDIR) com \
+ $(BOOT_JAR_JFLAGS)
+ @$(java-vm-cleanup)
+
+
+#
+# Rules
+#
+include $(BUILDDIR)/common/Classes.gmk
+
+clean clobber::
+ $(RM) -r $(CLASSDESTDIR) \
+ $(EXTDIR)/$(JARFILE)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/bridge/JavaAccessBridge/Files_cpp.gmk Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+#
+# Native files to compile.
+FILES_cpp = \
+ AccessBridgeATInstance.cpp \
+ AccessBridgeDebug.cpp \
+ AccessBridgeJavaEntryPoints.cpp \
+ AccessBridgeMessages.cpp \
+ JavaAccessBridge.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/bridge/JavaAccessBridge/Makefile Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,90 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+#
+# Makefile for building JavaAccessBridge.DLL
+#
+
+BUILDDIR = ../..
+LIBRARY = JavaAccessBridge$(ABSUFFIX)
+include $(BUILDDIR)/common/Defs.gmk
+
+# Indicate we want the C++ compiler to do the linking.
+CPLUSPLUSLIBRARY=true
+
+ifeq ($(ARCH_DATA_MODEL), 64)
+ ABSUFFIX = -64
+ ACCESSBRIDGE_ARCH = ACCESSBRIDGE_ARCH_64
+ ABRIDGE_MACHINE=X64
+else
+ifeq ($(ARCH_DATA_MODEL), 32)
+ ABRIDGE_MACHINE=I386
+ifdef ABLEGACY
+ ABSUFFIX =
+ ACCESSBRIDGE_ARCH = ACCESSBRIDGE_ARCH_LEGACY
+else
+ ABSUFFIX = -32
+ ACCESSBRIDGE_ARCH = ACCESSBRIDGE_ARCH_32
+endif
+endif
+endif
+
+include FILES_cpp.gmk
+
+PLATFORM_INCLUDE_BRIDGE = $(PLATFORM_INCLUDE)/bridge
+
+VERSIONINFO_RESOURCE = $(CLOSED_PLATFORM_SRC)/native/sun/bridge/AccessBridgeStatusWindow.rc
+
+OTHER_CPPFLAGS += -D$(ACCESSBRIDGE_ARCH) -I "$(INCLUDEDIR)" -I "$(PLATFORM_INCLUDE)"
+LDLIBS += kernel32.lib user32.lib gdi32.lib winspool.lib jawt.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
+ odbc32.lib odbccp32.lib /subsystem:windows /dll /incremental:no /machine:$(ABRIDGE_MACHINE) \
+ /def:$(CLOSED_PLATFORM_SRC)/native/sun/bridge/JavaAccessBridge.DEF /libpath:"$(LIBDIR)"
+
+all : build postbuild
+
+postbuild :
+ $(MKDIR) -p $(PLATFORM_INCLUDE_BRIDGE)
+ $(CP) $(CLOSED_PLATFORM_SRC)/native/sun/bridge/accessibility.properties $(LIBDIR)
+ $(CP) $(CLOSED_PLATFORM_SRC)/native/sun/bridge/AccessBridgeCallbacks.h $(PLATFORM_INCLUDE_BRIDGE)
+ $(CP) $(CLOSED_PLATFORM_SRC)/native/sun/bridge/AccessBridgeCalls.h $(PLATFORM_INCLUDE_BRIDGE)
+ $(CP) $(CLOSED_PLATFORM_SRC)/native/sun/bridge/AccessBridgePackages.h $(PLATFORM_INCLUDE_BRIDGE)
+ $(CP) $(CLOSED_PLATFORM_SRC)/native/sun/bridge/AccessBridgeCalls.c $(PLATFORM_INCLUDE_BRIDGE)
+
+#
+# Rules
+#
+include $(BUILDDIR)/common/Library.gmk
+
+vpath %.cpp $(CLOSED_PLATFORM_SRC)/native/sun/bridge
+vpath %.DEF $(CLOSED_PLATFORM_SRC)/native/sun/bridge
+vpath %.rc $(CLOSED_PLATFORM_SRC)/native/sun/bridge
+vpath %.c $(CLOSED_PLATFORM_SRC)/native/sun/bridge
+vpath %.h $(CLOSED_PLATFORM_SRC)/native/sun/bridge
+
+#
+# Extra clean rule.
+#
+clean clobber::
+ $(RM) $(FILES_h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/bridge/Makefile Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,65 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+#
+# Makefile for building Java Access Bridge
+#
+
+BUILDDIR = ..
+include $(BUILDDIR)/common/Defs.gmk
+
+#
+#
+ifndef OPENJDK
+ifeq ($(PLATFORM), windows)
+include $(BUILDDIR)/common/Subdirs.gmk
+
+#
+# build for 32 and 64 bit (new api)
+#
+SUBDIRS = Jaccess JavaAccessBridge WindowsAccessBridge JAWTAccessBridge AccessBridgeJava Jabswitch
+#
+# build for legacy
+#
+ifeq ($(ARCH_DATA_MODEL), 32)
+OTHERSUBDIRS_MAKEFLAGS += ABLEGACY=true
+OTHERSUBDIRS = JavaAccessBridge WindowsAccessBridge JAWTAccessBridge AccessBridgeJava
+endif
+
+ifeq ($(ARCH_DATA_MODEL), 32)
+all build clean clobber ::
+ $(SUBDIRS-loop)
+ $(OTHERSUBDIRS-loop)
+else
+all build clean clobber ::
+ $(SUBDIRS-loop)
+endif
+
+clean::
+ $(RM) -r $(CLASSBINDIR) $(CLASSBINDIR)
+
+endif # PLATFORM
+endif #OPENJDK
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/bridge/WindowsAccessBridge/Files_cpp.gmk Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+#
+# Native files to compile.
+FILES_cpp = \
+ AccessBridgeJavaVMInstance.cpp \
+ AccessBridgeMessageQueue.cpp \
+ AccessBridgeMessages.cpp \
+ AccessBridgeWindowsEntryPoints.cpp \
+ WinAccessBridge.cpp \
+ AccessBridgeDebug.cpp \
+ AccessBridgeEventHandler.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/bridge/WindowsAccessBridge/Makefile Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+#
+# Makefile for building WindowsAccessBridge.dll
+#
+
+BUILDDIR = ../..
+LIBRARY = WindowsAccessBridge$(ABSUFFIX)
+include $(BUILDDIR)/common/Defs.gmk
+
+# Indicate we want the C++ compiler to do the linking.
+CPLUSPLUSLIBRARY=true
+
+ifeq ($(ARCH_DATA_MODEL), 64)
+ ABSUFFIX = -64
+ ACCESSBRIDGE_ARCH = ACCESSBRIDGE_ARCH_64
+ ABRIDGE_MACHINE=X64
+else
+ifeq ($(ARCH_DATA_MODEL), 32)
+ ABRIDGE_MACHINE=I386
+ifdef ABLEGACY
+ ABSUFFIX =
+ ACCESSBRIDGE_ARCH = ACCESSBRIDGE_ARCH_LEGACY
+else
+ ABSUFFIX = -32
+ ACCESSBRIDGE_ARCH = ACCESSBRIDGE_ARCH_32
+endif
+endif
+endif
+
+include FILES_cpp.gmk
+
+VERSIONINFO_RESOURCE = $(CLOSED_PLATFORM_SRC)/native/sun/bridge/AccessBridgeStatusWindow.rc
+
+OTHER_CPPFLAGS += -MT -D$(ACCESSBRIDGE_ARCH) -I "$(INCLUDEDIR)" -I "$(PLATFORM_INCLUDE)"
+LDLIBS += kernel32.lib user32.lib gdi32.lib winspool.lib jawt.lib comdlg32.lib advapi32.lib shell32.lib \
+ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /subsystem:windows /dll /incremental:no /machine:$(ABRIDGE_MACHINE) \
+ /def:$(CLOSED_PLATFORM_SRC)/native/sun/bridge/WinAccessBridge.DEF /libpath:"$(LIBDIR)"
+
+
+#
+# Rules
+#
+include $(BUILDDIR)/common/Library.gmk
+
+vpath %.cpp $(CLOSED_PLATFORM_SRC)/native/sun/bridge
+vpath %.DEF $(CLOSED_PLATFORM_SRC)/native/sun/bridge
+vpath %.rc $(CLOSED_PLATFORM_SRC)/native/sun/bridge
--- a/jdk/makefiles/CompileJavaClasses.gmk Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/makefiles/CompileJavaClasses.gmk Tue Jan 29 20:19:48 2013 -0800
@@ -59,6 +59,12 @@
# This gets built on unix platforms implicitly in the old build even though
# it's excluded in the closed build.
EXCLUDES+=sun/java2d/pisces
+
+ # AccessBridge is compiled separately below.
+ EXFILES += AccessBridge.java \
+ com/sun/java/accessibility/util/java/awt/ChoiceTranslator.java
+ # This seems to never be built
+ EXCLUDES += com/sun/java/accessibility/extensions
endif
endif
@@ -248,10 +254,8 @@
# Now we have COPY_PATTERNS, COPY_FILES and COPY_EXTRA
ifndef OPENJDK
- CLOSED_SRC_DIRS:=$(JDK_TOPDIR)/src/closed/share/classes
- ifneq ($(OPENJDK_TARGET_OS_API_DIR),windows)
- CLOSED_SRC_DIRS += $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS_API_DIR)/classes
- endif
+ CLOSED_SRC_DIRS:=$(JDK_TOPDIR)/src/closed/share/classes \
+ $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS_API_DIR)/classes
endif
MACOSX_SRC_DIRS :=
@@ -364,8 +368,44 @@
##########################################################################################
-# copy with -a to preserve timestamps so dependencies down the line aren't messed up
+ifndef OPENJDK
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+ $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_32,\
+ SETUP:=GENERATE_JDKBYTECODE,\
+ JAVAC_FLAGS:=-cp $(JDK_OUTPUTDIR)/classes,\
+ SRC:=$(JDK_OUTPUTDIR)/gensrc_ab/32bit,\
+ BIN:=$(JDK_OUTPUTDIR)/classes_ab/32bit))
+
+ $(BUILD_ACCESSBRIDGE_32): $(BUILD_JDK)
+
+ $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_LEGACY,\
+ SETUP:=GENERATE_JDKBYTECODE,\
+ JAVAC_FLAGS:=-cp $(JDK_OUTPUTDIR)/classes,\
+ SRC:=$(JDK_OUTPUTDIR)/gensrc_ab/legacy,\
+ BIN:=$(JDK_OUTPUTDIR)/classes_ab/legacy))
+
+ $(BUILD_ACCESSBRIDGE_LEGACY): $(BUILD_JDK)
+
+else
+
+ $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_64,\
+ SETUP:=GENERATE_JDKBYTECODE,\
+ JAVAC_FLAGS:=-cp $(JDK_OUTPUTDIR)/classes,\
+ SRC:=$(JDK_OUTPUTDIR)/gensrc_ab/64bit,\
+ BIN:=$(JDK_OUTPUTDIR)/classes_ab/64bit))
+
+ $(BUILD_ACCESSBRIDGE_64): $(BUILD_JDK)
+
+endif
+endif
+endif
+
+##########################################################################################
+
all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
- $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin
+ $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
+ $(BUILD_ACCESSBRIDGE_32) $(BUILD_ACCESSBRIDGE_64) \
+ $(BUILD_ACCESSBRIDGE_LEGACY)
.PHONY: all
--- a/jdk/makefiles/CompileLaunchers.gmk Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/makefiles/CompileLaunchers.gmk Tue Jan 29 20:19:48 2013 -0800
@@ -591,6 +591,34 @@
endif
##########################################################################################
+# jabswitch
+
+ifndef OPENJDK
+ifeq ($(OPENJDK_TARGET_OS),windows)
+
+ $(eval $(call SetupNativeCompilation,BUILD_JABSWITCH,\
+ SRC:=$(JDK_TOPDIR)/src/closed/windows/native/sun/bridge,\
+ INCLUDE_FILES:=jabswitch.cpp,\
+ LANG:=C++,\
+ CFLAGS:=$(filter-out -Zc:wchar_t-,$(CFLAGS_JDKEXE)) -Zc:wchar_t \
+ -analyze- -Od -Gd -D_WINDOWS \
+ -D_UNICODE -DUNICODE -RTC1 -EHsc,\
+ LDFLAGS:=$(LDFLAGS_JDKEXE) \
+ Advapi32.lib Version.lib User32.lib,\
+ OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/jabswitch,\
+ OUTPUT_DIR:=$(JDK_OUTPUTDIR)/bin,\
+ PROGRAM:=jabswitch,\
+ DEBUG_SYMBOLS:=true,\
+ VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/windows/native/sun/bridge/AccessBridgeStatusWindow.rc,\
+ RC_FLAGS:=$(RC_FLAGS),\
+ MANIFEST:=$(JDK_TOPDIR)/src/closed/windows/native/sun/bridge/jabswitch.manifest))
+
+ BUILD_LAUNCHERS += $(BUILD_JABSWITCH)
+
+endif
+endif
+
+##########################################################################################
$(BUILD_LAUNCHERS) : $(JDK_TOPDIR)/makefiles/CompileLaunchers.gmk
--- a/jdk/makefiles/CompileNativeLibraries.gmk Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/makefiles/CompileNativeLibraries.gmk Tue Jan 29 20:19:48 2013 -0800
@@ -3296,6 +3296,97 @@
##########################################################################################
+ifndef OPENJDK
+ifeq ($(OPENJDK_TARGET_OS), windows)
+
+ ACCESSBRIDGE_SRCDIR:=$(JDK_TOPDIR)/src/closed/windows/native/sun/bridge
+
+ define SetupAccessBridge
+ # Parameter 1 Suffix
+ # Parameter 2 Machine
+ # Parameter 3 ACCESSBRIDGE_ARCH_ suffix
+
+ $(call SetupNativeCompilation,BUILD_JAWTACCESSBRIDGE$1,\
+ LIBRARY=JAWTAccessBridge$1,\
+ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
+ SRC:=$(ACCESSBRIDGE_SRCDIR),\
+ INCLUDE_FILES:=JAWTAccessBridge.cpp,\
+ LANG:=C++,\
+ OPTIMIZATION:=LOW,\
+ CFLAGS:=$(CFLAGS_JDKLIB) \
+ -DACCESSBRIDGE_ARCH_$3,\
+ LDFLAGS:=$(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
+ winspool.lib jawt.lib comdlg32.lib advapi32.lib shell32.lib \
+ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
+ -subsystem:windows -machine:$2 \
+ -def:$(ACCESSBRIDGE_SRCDIR)/JAWTAccessBridge.DEF,\
+ VERSIONINFO_RESOURCE:=$(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc,\
+ RC_FLAGS:=$(RC_FLAGS),\
+ OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawtaccessbridge$1,\
+ DEBUG_SYMBOLS:=true)
+
+ $$(BUILD_JAWTACCESSBRIDGE$1): $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
+
+ $(call SetupNativeCompilation,BUILD_JAVAACCESSBRIDGE$1,\
+ LIBRARY=JavaAccessBridge$1,\
+ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
+ SRC:=$(ACCESSBRIDGE_SRCDIR),\
+ INCLUDE_FILES:=AccessBridgeATInstance.cpp AccessBridgeDebug.cpp \
+ AccessBridgeJavaEntryPoints.cpp \
+ AccessBridgeMessages.cpp JavaAccessBridge.cpp,\
+ LANG:=C++,\
+ OPTIMIZATION:=LOW,\
+ CFLAGS:=$(CFLAGS_JDKLIB) \
+ -DACCESSBRIDGE_ARCH_$3,\
+ LDFLAGS:=$(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
+ winspool.lib comdlg32.lib advapi32.lib shell32.lib \
+ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
+ -subsystem:windows -machine:$2 \
+ -def:$(ACCESSBRIDGE_SRCDIR)/JavaAccessBridge.DEF,\
+ VERSIONINFO_RESOURCE:=$(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc,\
+ RC_FLAGS:=$(RC_FLAGS),\
+ OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjavaaccessbridge$1,\
+ DEBUG_SYMBOLS:=true)
+
+ $(call SetupNativeCompilation,BUILD_WINDOWSACCESSBRIDGE$1,\
+ LIBRARY=WindowsAccessBridge$1,\
+ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
+ SRC:=$(ACCESSBRIDGE_SRCDIR),\
+ INCLUDE_FILES:=AccessBridgeJavaVMInstance.cpp AccessBridgeMessageQueue.cpp \
+ AccessBridgeMessages.cpp AccessBridgeWindowsEntryPoints.cpp \
+ WinAccessBridge.cpp AccessBridgeDebug.cpp \
+ AccessBridgeEventHandler.cpp,\
+ LANG:=C++,\
+ OPTIMIZATION:=LOW,\
+ CFLAGS:=$(filter-out -MD,$(CFLAGS_JDKLIB)) -MT \
+ -DACCESSBRIDGE_ARCH_$3,\
+ LDFLAGS:=$(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
+ winspool.lib comdlg32.lib advapi32.lib shell32.lib \
+ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
+ -subsystem:windows -machine:$2 \
+ -def:$(ACCESSBRIDGE_SRCDIR)/WinAccessBridge.DEF,\
+ VERSIONINFO_RESOURCE:=$(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc,\
+ RC_FLAGS:=$(RC_FLAGS),\
+ OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libwindowsaccessbridge$1,\
+ DEBUG_SYMBOLS:=true)
+
+ BUILD_LIBRARIES += $$(BUILD_JAWTACCESSBRIDGE$1) $$(BUILD_JAVAACCESSBRIDGE$1) \
+ $$(BUILD_WINDOWSACCESSBRIDGE$1)
+
+ endef
+
+ ifeq ($(OPENJDK_TARGET_CPU_BITS),32)
+ $(eval $(call SetupAccessBridge,-32,I386,32))
+ $(eval $(call SetupAccessBridge,,I386,LEGACY))
+ else
+ $(eval $(call SetupAccessBridge,-64,X64,64))
+ endif
+endif
+endif
+
+
+##########################################################################################
+
all: $(COPY_FILES) $(BUILD_LIBRARIES)
.PHONY: all
--- a/jdk/makefiles/CopyFiles.gmk Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/makefiles/CopyFiles.gmk Tue Jan 29 20:19:48 2013 -0800
@@ -42,7 +42,7 @@
$(INCLUDEDIR)/jvmticmlr.h \
$(INCLUDEDIR)/classfile_constants.h \
$(INCLUDEDIR)/jawt.h \
- $(OPENJDK_TARGET_OS_INCLUDE)/jni_md.h \
+ $(OPENJDK_TARGET_OS_INCLUDE)/jni_md.h \
$(OPENJDK_TARGET_OS_INCLUDE)/jawt_md.h
$(INCLUDEDIR)/%.h: $(JDK_TOPDIR)/src/share/javavm/export/%.h
@@ -59,6 +59,27 @@
##########################################################################################
+ifndef OPENJDK
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ COPY_FILES += $(OPENJDK_TARGET_OS_INCLUDE)/bridge/AccessBridgeCallbacks.h \
+ $(OPENJDK_TARGET_OS_INCLUDE)/bridge/AccessBridgeCalls.h \
+ $(OPENJDK_TARGET_OS_INCLUDE)/bridge/AccessBridgePackages.h \
+ $(OPENJDK_TARGET_OS_INCLUDE)/bridge/AccessBridgeCalls.c \
+ $(JDK_OUTPUTDIR)/lib/accessibility.properties
+
+ $(OPENJDK_TARGET_OS_INCLUDE)/bridge/%: \
+ $(JDK_TOPDIR)/src/closed/windows/native/sun/bridge/%
+ $(install-file)
+
+ $(JDK_OUTPUTDIR)/lib/accessibility.properties: \
+ $(JDK_TOPDIR)/src/closed/windows/native/sun/bridge/accessibility.properties
+ $(install-file)
+
+endif
+endif
+
+##########################################################################################
+
LIBDIR = $(JDK_OUTPUTDIR)/lib
SERVICETAG_LIBDIR = $(LIBDIR)/servicetag
--- a/jdk/makefiles/CreateJars.gmk Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/makefiles/CreateJars.gmk Tue Jan 29 20:19:48 2013 -0800
@@ -141,6 +141,7 @@
com/sun/crypto/provider \
com/sun/istack/internal/tools \
com/sun/jarsigner \
+ com/sun/java/accessibility \
com/sun/javadoc \
com/sun/jdi \
com/sun/net/ssl/internal/ssl \
@@ -941,6 +942,47 @@
##########################################################################################
+ifndef OPENJDK
+ifeq ($(OPENJDK_TARGET_OS), windows)
+
+ $(eval $(call SetupArchive,BUILD_JACCESS_JAR,,\
+ SRCS:=$(JDK_OUTPUTDIR)/classes,\
+ INCLUDES:=com/sun/java/accessibility/util,\
+ JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/jaccess.jar,\
+ SKIP_METAINF:=true))
+
+ JARS += $(IMAGES_OUTPUTDIR)/lib/ext/jaccess.jar
+
+ ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+ $(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_32_JAR,,\
+ SRCS:=$(JDK_OUTPUTDIR)/classes_ab/32bit $(JDK_OUTPUTDIR)/classes,\
+ INCLUDES:=com/sun/java/accessibility,\
+ JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-32.jar,\
+ SKIP_METAINF:=true))
+
+ $(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_LEGACY_JAR,,\
+ SRCS:=$(JDK_OUTPUTDIR)/classes_ab/legacy $(JDK_OUTPUTDIR)/classes,\
+ INCLUDES:=com/sun/java/accessibility,\
+ JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/access-bridge.jar,\
+ SKIP_METAINF:=true))
+
+ JARS += $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-32.jar \
+ $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge.jar
+ else
+ $(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_64_JAR,,\
+ SRCS:=$(JDK_OUTPUTDIR)/classes_ab/64bit $(JDK_OUTPUTDIR)/classes,\
+ INCLUDES:=com/sun/java/accessibility,\
+ EXCLUDES:=com/sun/java/accessibility/util/java,\
+ JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-64.jar,\
+ SKIP_METAINF:=true))
+
+ JARS += $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-64.jar
+ endif
+endif
+endif
+
+##########################################################################################
+
#
# This is an empty jar (only contains manifest) and fits poorly into framework...
# create simple rule instead
--- a/jdk/makefiles/GensrcMisc.gmk Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/makefiles/GensrcMisc.gmk Tue Jan 29 20:19:48 2013 -0800
@@ -190,3 +190,36 @@
endif
+
+##########################################################################################
+
+ifndef OPENJDK
+ifeq ($(OPENJDK_TARGET_OS), windows)
+
+ AB_GENSRC_DIR := $(JDK_OUTPUTDIR)/gensrc_ab
+ AB_SRC_DIR := $(JDK_TOPDIR)/src/closed/windows/classes/com/sun/java/accessibility
+
+ ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+ $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java: \
+ $(AB_SRC_DIR)/32bit/AccessBridge.java
+ $(install-file)
+
+ $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java: \
+ $(AB_SRC_DIR)/legacy/AccessBridge.java
+ $(install-file)
+
+ GENSRC_MISC += $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java \
+ $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java
+
+ else
+ $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java: \
+ $(AB_SRC_DIR)/64bit/AccessBridge.java
+ $(install-file)
+
+ GENSRC_MISC += $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java
+
+ endif
+endif
+endif
+
+##########################################################################################
\ No newline at end of file
--- a/jdk/src/macosx/classes/com/apple/laf/AquaKeyBindings.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaKeyBindings.java Tue Jan 29 20:19:48 2013 -0800
@@ -142,6 +142,21 @@
}));
}
+ LateBoundInputMap getPasswordFieldInputMap() {
+ return new LateBoundInputMap(new SimpleBinding(getTextFieldInputMap().getBindings()),
+ // nullify all the bindings that may discover space characters in the text
+ new SimpleBinding(new String[] {
+ "alt LEFT", null,
+ "alt KP_LEFT", null,
+ "alt RIGHT", null,
+ "alt KP_RIGHT", null,
+ "shift alt LEFT", null,
+ "shift alt KP_LEFT", null,
+ "shift alt RIGHT", null,
+ "shift alt KP_RIGHT", null,
+ }));
+ }
+
LateBoundInputMap getMultiLineTextInputMap() {
return new LateBoundInputMap(new SimpleBinding(commonTextEditorBindings), new SimpleBinding(new String[] {
"ENTER", DefaultEditorKit.insertBreakAction,
--- a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java Tue Jan 29 20:19:48 2013 -0800
@@ -697,7 +697,7 @@
"Panel.foreground", black,
"Panel.opaque", useOpaqueComponents,
- "PasswordField.focusInputMap", aquaKeyBindings.getTextFieldInputMap(),
+ "PasswordField.focusInputMap", aquaKeyBindings.getPasswordFieldInputMap(),
"PasswordField.font", controlFont,
"PasswordField.background", textBackground,
"PasswordField.foreground", textForeground,
--- a/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java Tue Jan 29 20:19:48 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@
import sun.java2d.*;
import sun.print.*;
import apple.laf.*;
-import apple.laf.JRSUIConstants.Widget;
import apple.laf.JRSUIUtils.NineSliceMetricsProvider;
abstract class AquaPainter <T extends JRSUIState> {
@@ -63,7 +62,7 @@
}
static <T extends JRSUIState> AquaPainter<T> create(final T state, final NineSliceMetricsProvider metricsProvider) {
- return new AquaNineSlicingImagePainter<T>(state, metricsProvider);
+ return new AquaNineSlicingImagePainter<>(state, metricsProvider);
}
abstract void paint(final Graphics2D g, final T stateToPaint, final Component c);
@@ -71,7 +70,7 @@
final Rectangle boundsRect = new Rectangle();
final JRSUIControl control;
T state;
- public AquaPainter(final JRSUIControl control, final T state) {
+ AquaPainter(final JRSUIControl control, final T state) {
this.control = control;
this.state = state;
}
@@ -94,14 +93,14 @@
protected final HashMap<T, RecyclableJRSUISlicedImageControl> slicedControlImages;
protected final NineSliceMetricsProvider metricsProvider;
- public AquaNineSlicingImagePainter(final T state) {
+ AquaNineSlicingImagePainter(final T state) {
this(state, null);
}
- public AquaNineSlicingImagePainter(final T state, final NineSliceMetricsProvider metricsProvider) {
+ AquaNineSlicingImagePainter(final T state, final NineSliceMetricsProvider metricsProvider) {
super(new JRSUIControl(false), state);
this.metricsProvider = metricsProvider;
- slicedControlImages = new HashMap<T, RecyclableJRSUISlicedImageControl>();
+ slicedControlImages = new HashMap<>();
}
@Override
@@ -127,7 +126,7 @@
}
static class AquaSingleImagePainter<T extends JRSUIState> extends AquaPainter<T> {
- public AquaSingleImagePainter(final T state) {
+ AquaSingleImagePainter(final T state) {
super(new JRSUIControl(false), state);
}
@@ -137,12 +136,12 @@
}
static void paintFromSingleCachedImage(final Graphics2D g, final JRSUIControl control, final JRSUIState controlState, final Component c, final Rectangle boundsRect) {
- Rectangle clipRect = g.getClipBounds();
- Rectangle intersection = boundsRect.intersection(clipRect);
+ final Rectangle clipRect = g.getClipBounds();
+ final Rectangle intersection = boundsRect.intersection(clipRect);
if (intersection.width <= 0 || intersection.height <= 0) return;
- int imgX1 = intersection.x - boundsRect.x;
- int imgY1 = intersection.y - boundsRect.y;
+ final int imgX1 = intersection.x - boundsRect.x;
+ final int imgY1 = intersection.y - boundsRect.y;
final GraphicsConfiguration config = g.getDeviceConfiguration();
final ImageCache cache = ImageCache.getInstance();
@@ -150,19 +149,14 @@
if (image == null) {
image = new BufferedImage(boundsRect.width, boundsRect.height, BufferedImage.TYPE_INT_ARGB_PRE);
cache.setImage(image, config, boundsRect.width, boundsRect.height, controlState);
- } else {
- g.drawImage(image, intersection.x, intersection.y, intersection.x + intersection.width, intersection.y + intersection.height,
- imgX1, imgY1, imgX1 + intersection.width, imgY1 + intersection.height, null);
- return;
- }
+ final WritableRaster raster = image.getRaster();
+ final DataBufferInt buffer = (DataBufferInt)raster.getDataBuffer();
- final WritableRaster raster = image.getRaster();
- final DataBufferInt buffer = (DataBufferInt)raster.getDataBuffer();
-
- control.set(controlState);
- control.paint(SunWritableRaster.stealData(buffer, 0),
- image.getWidth(), image.getHeight(), 0, 0, boundsRect.width, boundsRect.height);
- SunWritableRaster.markDirty(buffer);
+ control.set(controlState);
+ control.paint(SunWritableRaster.stealData(buffer, 0),
+ image.getWidth(), image.getHeight(), 0, 0, boundsRect.width, boundsRect.height);
+ SunWritableRaster.markDirty(buffer);
+ }
g.drawImage(image, intersection.x, intersection.y, intersection.x + intersection.width, intersection.y + intersection.height,
imgX1, imgY1, imgX1 + intersection.width, imgY1 + intersection.height, null);
@@ -173,7 +167,7 @@
final JRSUIControl control;
final JRSUIState state;
- public RecyclableJRSUISlicedImageControl(final JRSUIControl control, final JRSUIState state, final NineSliceMetrics metrics) {
+ RecyclableJRSUISlicedImageControl(final JRSUIControl control, final JRSUIState state, final NineSliceMetrics metrics) {
super(metrics);
this.control = control;
this.state = state;
--- a/jdk/src/macosx/classes/com/apple/laf/ImageCache.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/com/apple/laf/ImageCache.java Tue Jan 29 20:19:48 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
import java.util.*;
import java.util.concurrent.locks.*;
+import apple.laf.JRSUIConstants;
import apple.laf.JRSUIState;
import com.apple.laf.AquaUtils.RecyclableSingleton;
@@ -38,9 +39,9 @@
* SoftReferences so they will be dropped by the GC if heap memory gets tight. When our size hits max pixel count least
* recently requested images are removed first.
*/
-class ImageCache {
+final class ImageCache {
// Ordered Map keyed by args hash, ordered by most recent accessed entry.
- private final LinkedHashMap<Integer, PixelCountSoftReference> map = new LinkedHashMap<Integer, PixelCountSoftReference>(16, 0.75f, true);
+ private final LinkedHashMap<Integer, PixelCountSoftReference> map = new LinkedHashMap<>(16, 0.75f, true);
// Maximum number of pixels to cache, this is used if maxCount
private final int maxPixelCount;
@@ -50,7 +51,7 @@
// Lock for concurrent access to map
private final ReadWriteLock lock = new ReentrantReadWriteLock();
// Reference queue for tracking lost softreferences to images in the cache
- private final ReferenceQueue<Image> referenceQueue = new ReferenceQueue<Image>();
+ private final ReferenceQueue<Image> referenceQueue = new ReferenceQueue<>();
// Singleton Instance
private static final RecyclableSingleton<ImageCache> instance = new RecyclableSingleton<ImageCache>() {
@@ -63,11 +64,11 @@
return instance.get();
}
- public ImageCache(final int maxPixelCount) {
+ ImageCache(final int maxPixelCount) {
this.maxPixelCount = maxPixelCount;
}
- public ImageCache() {
+ ImageCache() {
this((8 * 1024 * 1024) / 4); // 8Mb of pixels
}
@@ -99,10 +100,13 @@
* @param config The graphics configuration, needed if cached image is a Volatile Image. Used as part of cache key
* @param w The image width, used as part of cache key
* @param h The image height, used as part of cache key
- * @param args Other arguments to use as part of the cache key
- * @return true if the image could be cached or false if the image is too big
+ * @return true if the image could be cached, false otherwise.
*/
public boolean setImage(final Image image, final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) {
+ if (state.is(JRSUIConstants.Animating.YES)) {
+ return false;
+ }
+
final int hash = hash(config, w, h, state);
lock.writeLock().lock();
@@ -167,7 +171,7 @@
private final int h;
private final JRSUIState state;
- public PixelCountSoftReference(final Image referent, final ReferenceQueue<? super Image> q, final int pixelCount, final int hash, final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) {
+ PixelCountSoftReference(final Image referent, final ReferenceQueue<? super Image> q, final int pixelCount, final int hash, final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) {
super(referent, q);
this.pixelCount = pixelCount;
this.hash = hash;
--- a/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java Tue Jan 29 20:19:48 2013 -0800
@@ -30,6 +30,7 @@
import java.awt.Window;
import java.awt.AWTPermission;
import java.awt.DisplayMode;
+import java.util.Objects;
import sun.java2d.opengl.CGLGraphicsConfig;
@@ -122,12 +123,12 @@
boolean fsSupported = isFullScreenSupported();
if (fsSupported && old != null) {
- // enter windowed mode (and restore original display mode)
- exitFullScreenExclusive(old);
+ // restore original display mode and enter windowed mode.
if (originalMode != null) {
setDisplayMode(originalMode);
originalMode = null;
}
+ exitFullScreenExclusive(old);
}
super.setFullScreenWindow(w);
@@ -186,13 +187,20 @@
}
@Override
- public void setDisplayMode(DisplayMode dm) {
+ public void setDisplayMode(final DisplayMode dm) {
if (dm == null) {
throw new IllegalArgumentException("Invalid display mode");
}
- nativeSetDisplayMode(displayID, dm.getWidth(), dm.getHeight(), dm.getBitDepth(), dm.getRefreshRate());
- if (isFullScreenSupported() && getFullScreenWindow() != null) {
- getFullScreenWindow().setSize(dm.getWidth(), dm.getHeight());
+ if (!Objects.equals(dm, getDisplayMode())) {
+ final Window w = getFullScreenWindow();
+ if (w != null) {
+ exitFullScreenExclusive(w);
+ }
+ nativeSetDisplayMode(displayID, dm.getWidth(), dm.getHeight(),
+ dm.getBitDepth(), dm.getRefreshRate());
+ if (isFullScreenSupported() && w != null) {
+ enterFullScreenExclusive(w);
+ }
}
}
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java Tue Jan 29 20:19:48 2013 -0800
@@ -1226,7 +1226,7 @@
sendEventToDelegate(e);
}
- private void sendEventToDelegate(final AWTEvent e) {
+ protected void sendEventToDelegate(final AWTEvent e) {
synchronized (getDelegateLock()) {
if (getDelegate() == null || !isShowing() || !isEnabled()) {
return;
--- a/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java Tue Jan 29 20:19:48 2013 -0800
@@ -29,6 +29,7 @@
import javax.swing.event.ChangeListener;
import javax.swing.event.ChangeEvent;
import java.awt.*;
+import java.awt.event.MouseWheelEvent;
import java.awt.peer.ScrollPanePeer;
import java.util.List;
@@ -52,6 +53,21 @@
}
@Override
+ public void handleEvent(AWTEvent e) {
+ if (e instanceof MouseWheelEvent) {
+ MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
+ //java.awt.ScrollPane consumes the event
+ // in case isWheelScrollingEnabled() is true,
+ // forcibly send the consumed event to the delegate
+ if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
+ sendEventToDelegate(wheelEvent);
+ }
+ } else {
+ super.handleEvent(e);
+ }
+ }
+
+ @Override
public void stateChanged(final ChangeEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
--- a/jdk/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java Tue Jan 29 20:19:48 2013 -0800
@@ -34,7 +34,7 @@
import java.awt.event.FocusEvent;
import java.awt.peer.TextFieldPeer;
-import javax.swing.JPasswordField;
+import javax.swing.*;
import javax.swing.text.JTextComponent;
final class LWTextFieldPeer
@@ -48,7 +48,7 @@
@Override
protected JPasswordField createDelegate() {
- return new JTextAreaDelegate();
+ return new JPasswordFieldDelegate();
}
@Override
@@ -69,9 +69,18 @@
public void setEchoChar(final char echoChar) {
synchronized (getDelegateLock()) {
getDelegate().setEchoChar(echoChar);
- getDelegate().putClientProperty("JPasswordField.cutCopyAllowed",
- getDelegate().echoCharIsSet()
- ? Boolean.FALSE : Boolean.TRUE);
+ final boolean cutCopyAllowed;
+ final String focusInputMapKey;
+ if (echoChar != 0) {
+ cutCopyAllowed = false;
+ focusInputMapKey = "PasswordField.focusInputMap";
+ } else {
+ cutCopyAllowed = true;
+ focusInputMapKey = "TextField.focusInputMap";
+ }
+ getDelegate().putClientProperty("JPasswordField.cutCopyAllowed", cutCopyAllowed);
+ InputMap inputMap = (InputMap) UIManager.get(focusInputMapKey);
+ SwingUtilities.replaceUIInputMap(getDelegate(), JComponent.WHEN_FOCUSED, inputMap);
}
}
@@ -106,11 +115,11 @@
super.handleJavaFocusEvent(e);
}
- private final class JTextAreaDelegate extends JPasswordField {
+ private final class JPasswordFieldDelegate extends JPasswordField {
// Empty non private constructor was added because access to this
// class shouldn't be emulated by a synthetic accessor method.
- JTextAreaDelegate() {
+ JPasswordFieldDelegate() {
super();
}
--- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java Tue Jan 29 20:19:48 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -539,7 +539,7 @@
@Override
public void ungrab(Window w) {
if (w.getPeer() != null) {
- ((LWWindowPeer)w.getPeer()).ungrab();
+ ((LWWindowPeer)w.getPeer()).ungrab(false);
}
}
}
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java Tue Jan 29 20:19:48 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer");
- private PlatformWindow platformWindow;
+ private final PlatformWindow platformWindow;
// Window bounds reported by the native system (as opposed to
// regular bounds inherited from LWComponentPeer which are
@@ -554,12 +554,14 @@
/**
* Called by the {@code PlatformWindow} when this window is moved/resized by
- * user. There's no notifyReshape() in LWComponentPeer as the only
- * components which could be resized by user are top-level windows.
+ * user or window insets are changed. There's no notifyReshape() in
+ * LWComponentPeer as the only components which could be resized by user are
+ * top-level windows.
*/
public final void notifyReshape(int x, int y, int w, int h) {
final boolean moved;
final boolean resized;
+ final boolean invalid = updateInsets(platformWindow.getInsets());
synchronized (getStateLock()) {
moved = (x != sysX) || (y != sysY);
resized = (w != sysW) || (h != sysH);
@@ -570,7 +572,7 @@
}
// Check if anything changed
- if (!moved && !resized) {
+ if (!moved && !resized && !invalid) {
return;
}
// First, update peer's bounds
@@ -584,10 +586,10 @@
}
// Third, COMPONENT_MOVED/COMPONENT_RESIZED/PAINT events
- if (moved) {
+ if (moved || invalid) {
handleMove(x, y, true);
}
- if (resized) {
+ if (resized || invalid) {
handleResize(w, h, true);
repaintPeer();
}
@@ -999,27 +1001,21 @@
}
}
- /*
- * Request the window insets from the delegate and compares it
- * with the current one. This method is mostly called by the
- * delegate, e.g. when the window state is changed and insets
- * should be recalculated.
- *
+ /**
+ * Request the window insets from the delegate and compares it with the
+ * current one. This method is mostly called by the delegate, e.g. when the
+ * window state is changed and insets should be recalculated.
+ * <p/>
* This method may be called on the toolkit thread.
*/
- public boolean updateInsets(Insets newInsets) {
- boolean changed = false;
+ public final boolean updateInsets(final Insets newInsets) {
synchronized (getStateLock()) {
- changed = (insets.equals(newInsets));
+ if (insets.equals(newInsets)) {
+ return false;
+ }
insets = newInsets;
}
-
- if (changed) {
- replaceSurfaceData();
- repaintPeer();
- }
-
- return changed;
+ return true;
}
public static LWWindowPeer getWindowUnderCursor() {
@@ -1208,13 +1204,19 @@
grabbingWindow = this;
}
- void ungrab() {
+ final void ungrab(boolean doPost) {
if (isGrabbing()) {
grabbingWindow = null;
- postEvent(new UngrabEvent(getTarget()));
+ if (doPost) {
+ postEvent(new UngrabEvent(getTarget()));
+ }
}
}
+ void ungrab() {
+ ungrab(true);
+ }
+
private boolean isGrabbing() {
return this == grabbingWindow;
}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java Tue Jan 29 20:19:48 2013 -0800
@@ -273,8 +273,31 @@
@Override
protected ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList) throws IOException {
- // TODO Auto-generated method stub
- return null;
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ for (int i = 0; i < fileList.size(); i++)
+ {
+ byte[] bytes = fileList.get(i).getBytes();
+ bos.write(bytes, 0, bytes.length);
+ bos.write(0);
+ }
+ return bos;
+ }
+
+ @Override
+ protected boolean isURIListFormat(long format) {
+ String nat = getNativeForFormat(format);
+ if (nat == null) {
+ return false;
+ }
+ try {
+ DataFlavor df = new DataFlavor(nat);
+ if (df.getPrimaryType().equals("text") && df.getSubType().equals("uri-list")) {
+ return true;
+ }
+ } catch (Exception e) {
+ // Not a MIME format.
+ }
+ return false;
}
}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Tue Jan 29 20:19:48 2013 -0800
@@ -27,7 +27,6 @@
import java.awt.*;
import java.awt.geom.Rectangle2D;
-import java.awt.image.VolatileImage;
import sun.awt.CGraphicsConfig;
import sun.awt.CGraphicsEnvironment;
@@ -89,29 +88,8 @@
return peer;
}
- public void enterFullScreenMode(final long nsWindowPtr) {
+ public void enterFullScreenMode() {
CWrapper.NSView.enterFullScreenMode(ptr);
-
- // REMIND: CGLSurfaceData expects top-level's size
- // and therefore we need to account insets before
- // recreating the surface data
- Insets insets = peer.getInsets();
-
- Rectangle screenBounds;
- final long screenPtr = CWrapper.NSWindow.screen(nsWindowPtr);
- try {
- screenBounds = CWrapper.NSScreen.frame(screenPtr).getBounds();
- } finally {
- CWrapper.NSObject.release(screenPtr);
- }
-
- // the move/size notification from the underlying system comes
- // but it contains a bounds smaller than the whole screen
- // and therefore we need to create the synthetic notifications
- peer.notifyReshape(screenBounds.x - insets.left,
- screenBounds.y - insets.bottom,
- screenBounds.width + insets.left + insets.right,
- screenBounds.height + insets.top + insets.bottom);
}
public void exitFullScreenMode() {
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Jan 29 20:19:48 2013 -0800
@@ -38,7 +38,6 @@
import sun.java2d.SurfaceData;
import sun.java2d.opengl.CGLSurfaceData;
import sun.lwawt.*;
-import sun.lwawt.LWWindowPeer.PeerType;
import sun.util.logging.PlatformLogger;
import com.apple.laf.*;
@@ -58,7 +57,6 @@
private static native void nativeRevalidateNSWindowShadow(long nsWindowPtr);
private static native void nativeSetNSWindowMinimizedIcon(long nsWindowPtr, long nsImage);
private static native void nativeSetNSWindowRepresentedFilename(long nsWindowPtr, String representedFilename);
- private static native void nativeSetNSWindowSecurityWarningPositioning(long nsWindowPtr, double x, double y, float biasX, float biasY);
private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled);
private static native void nativeSynthesizeMouseEnteredExitedEvents();
private static native void nativeDispose(long nsWindowPtr);
@@ -197,7 +195,8 @@
// 1) setting native bounds via nativeSetBounds() call
// 2) getting notification from the native level via deliverMoveResizeEvent()
private Rectangle nativeBounds = new Rectangle(0, 0, 0, 0);
- private volatile boolean isFullScreenMode = false;
+ private volatile boolean isFullScreenMode;
+ private boolean isFullScreenAnimationOn;
private Window target;
private LWWindowPeer peer;
@@ -415,8 +414,10 @@
@Override // PlatformWindow
public Insets getInsets() {
- final Insets insets = nativeGetNSWindowInsets(getNSWindowPtr());
- return insets;
+ if (!isFullScreenMode) {
+ return nativeGetNSWindowInsets(getNSWindowPtr());
+ }
+ return new Insets(0, 0, 0, 0);
}
@Override // PlatformWindow
@@ -728,7 +729,19 @@
@Override
public void enterFullScreenMode() {
isFullScreenMode = true;
- contentView.enterFullScreenMode(getNSWindowPtr());
+ contentView.enterFullScreenMode();
+ // the move/size notification from the underlying system comes
+ // but it contains a bounds smaller than the whole screen
+ // and therefore we need to create the synthetic notifications
+ Rectangle screenBounds;
+ final long screenPtr = CWrapper.NSWindow.screen(getNSWindowPtr());
+ try {
+ screenBounds = CWrapper.NSScreen.frame(screenPtr).getBounds();
+ } finally {
+ CWrapper.NSObject.release(screenPtr);
+ }
+ peer.notifyReshape(screenBounds.x, screenBounds.y, screenBounds.width,
+ screenBounds.height);
}
@Override
@@ -875,11 +888,10 @@
final Rectangle oldB = nativeBounds;
nativeBounds = new Rectangle(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) {
flushBuffers();
}
- //TODO validateSurface already called from notifyReshape
- validateSurface();
}
private void deliverWindowClosingEvent() {
@@ -924,6 +936,10 @@
return false;
}
+ if (blocker instanceof CPrinterDialogPeer) {
+ return true;
+ }
+
CPlatformWindow pWindow = (CPlatformWindow)blocker.getPlatformWindow();
pWindow.orderAboveSiblings();
@@ -975,27 +991,19 @@
orderAboveSiblings();
}
- private void updateDisplay() {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- validateSurface();
- }
- });
+ private void windowWillEnterFullScreen() {
+ isFullScreenAnimationOn = true;
+ }
+
+ private void windowDidEnterFullScreen() {
+ isFullScreenAnimationOn = false;
}
- private void updateWindowContent() {
- ComponentEvent resizeEvent = new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED);
- SunToolkit.postEvent(SunToolkit.targetToAppContext(target), resizeEvent);
+ private void windowWillExitFullScreen() {
+ isFullScreenAnimationOn = true;
}
- private void windowWillEnterFullScreen() {
- updateWindowContent();
- }
- private void windowDidEnterFullScreen() {
- updateDisplay();
+ private void windowDidExitFullScreen() {
+ isFullScreenAnimationOn = false;
}
- private void windowWillExitFullScreen() {
- updateWindowContent();
- }
- private void windowDidExitFullScreen() {}
}
--- a/jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.m Tue Jan 29 20:19:48 2013 -0800
@@ -101,8 +101,7 @@
JNF_COCOA_ENTER(env);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+
CALayer *windowLayer = jlong_to_ptr(windowLayerPtr);
surfaceLayers = [[AWTSurfaceLayers alloc] initWithWindowLayer: windowLayer];
CFRetain(surfaceLayers);
@@ -127,7 +126,6 @@
AWTSurfaceLayers *surfaceLayers = OBJC(surfaceLayersPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
- AWT_ASSERT_APPKIT_THREAD;
CGRect rect = CGRectMake(x, y, width, height);
[surfaceLayers setBounds: rect];
--- a/jdk/src/macosx/native/sun/awt/AWTView.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m Tue Jan 29 20:19:48 2013 -0800
@@ -1243,8 +1243,7 @@
jobject cPlatformView = (*env)->NewGlobalRef(env, obj);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+
CALayer *windowLayer = jlong_to_ptr(windowLayerPtr);
AWTView *view = [[AWTView alloc] initWithRect:rect
platformView:cPlatformView
@@ -1274,8 +1273,7 @@
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+
if (toResize) {
[view setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable];
} else {
@@ -1308,8 +1306,7 @@
NSWindow *window = [view window];
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+
ret = (jint)[[AWTWindow getNSWindowDisplayID_AppKitThread: window] intValue];
}];
@@ -1336,8 +1333,7 @@
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+
NSRect viewBounds = [view bounds];
NSRect frameInWindow = [view convertRect:viewBounds toView:nil];
rect = [[view window] convertRectToScreen:frameInWindow];
@@ -1366,9 +1362,7 @@
JNF_COCOA_ENTER(env);
NSView *nsView = OBJC(viewPtr);
- [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
NSPoint ptWindowCoords = [[nsView window] mouseLocationOutsideOfEventStream];
NSPoint ptViewCoords = [nsView convertPoint:ptWindowCoords fromView:nil];
underMouse = [nsView hitTest:ptViewCoords] != nil;
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m Tue Jan 29 20:19:48 2013 -0800
@@ -738,14 +738,12 @@
__block AWTWindow *window = nil;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNFWeakJObjectWrapper *platformWindow = [JNFWeakJObjectWrapper wrapperWithJObject:obj withEnv:env];
NSView *contentView = OBJC(contentViewPtr);
NSRect frameRect = NSMakeRect(x, y, w, h);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
window = [[AWTWindow alloc] initWithPlatformWindow:platformWindow
styleBits:styleBits
@@ -770,11 +768,9 @@
(JNIEnv *env, jclass clazz, jlong windowPtr, jint mask, jint bits)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSWindow *nsWindow = OBJC(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
@@ -807,12 +803,10 @@
(JNIEnv *env, jclass clazz, jlong windowPtr, jlong menuBarPtr)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSWindow *nsWindow = OBJC(windowPtr);
CMenuBar *menuBar = OBJC(menuBarPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
@@ -838,14 +832,12 @@
jobject ret = NULL;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSWindow *nsWindow = OBJC(windowPtr);
__block NSRect contentRect = NSZeroRect;
__block NSRect frame = NSZeroRect;
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
frame = [nsWindow frame];
contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[nsWindow styleMask]];
@@ -873,14 +865,12 @@
(JNIEnv *env, jclass clazz, jlong windowPtr, jdouble originX, jdouble originY, jdouble width, jdouble height)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSRect jrect = NSMakeRect(originX, originY, width, height);
// TODO: not sure we need displayIfNeeded message in our view
NSWindow *nsWindow = OBJC(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
@@ -913,7 +903,6 @@
(JNIEnv *env, jclass clazz, jlong windowPtr, jdouble minW, jdouble minH, jdouble maxW, jdouble maxH)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
if (minW < 1) minW = 1;
if (minH < 1) minH = 1;
@@ -921,8 +910,7 @@
if (maxH < 1) maxH = 1;
NSWindow *nsWindow = OBJC(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
@@ -949,12 +937,9 @@
(JNIEnv *env, jclass clazz, jlong windowPtr)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSWindow *nsWindow = OBJC(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[nsWindow orderBack:nil];
}];
@@ -970,11 +955,9 @@
(JNIEnv *env, jclass clazz, jlong windowPtr)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSWindow *nsWindow = OBJC(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
if (![nsWindow isKeyWindow]) {
[nsWindow makeKeyAndOrderFront:nsWindow];
@@ -995,7 +978,6 @@
(JNIEnv *env, jclass clazz, jlong windowPtr, jstring jtitle)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSWindow *nsWindow = OBJC(windowPtr);
[nsWindow performSelectorOnMainThread:@selector(setTitle:)
@@ -1016,15 +998,9 @@
JNF_COCOA_ENTER(env);
NSWindow *nsWindow = OBJC(windowPtr);
- if ([NSThread isMainThread]) {
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[nsWindow invalidateShadow];
- } else {
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
- [nsWindow invalidateShadow];
- }];
- }
+ }];
JNF_COCOA_EXIT(env);
}
@@ -1060,13 +1036,10 @@
(JNIEnv *env, jclass clazz, jlong windowPtr, jlong nsImagePtr)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSWindow *nsWindow = OBJC(windowPtr);
NSImage *image = OBJC(nsImagePtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[nsWindow setMiniwindowImage:image];
}];
@@ -1082,13 +1055,10 @@
(JNIEnv *env, jclass clazz, jlong windowPtr, jstring filename)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSWindow *nsWindow = OBJC(windowPtr);
NSURL *url = (filename == NULL) ? nil : [NSURL fileURLWithPath:JNFNormalizedNSStringForPath(env, filename)];
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[nsWindow setRepresentedURL:url];
}];
@@ -1097,22 +1067,6 @@
/*
* Class: sun_lwawt_macosx_CPlatformWindow
- * Method: nativeSetNSWindowSecurityWarningPositioning
- * Signature: (JDDFF)V
- */
-JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowSecurityWarningPositioning
-(JNIEnv *env, jclass clazz, jlong windowPtr, jdouble x, jdouble y, jfloat biasX, jfloat biasY)
-{
-JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
-
- [JNFException raise:env as:kRuntimeException reason:"unimplemented"];
-
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeGetTopmostPlatformWindowUnderMouse
* Signature: (J)V
*/
@@ -1144,10 +1098,8 @@
(JNIEnv *env, jclass clazz)
{
JNF_COCOA_ENTER(env);
- AWT_ASSERT_NOT_APPKIT_THREAD;
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
}];
@@ -1168,7 +1120,7 @@
SEL toggleFullScreenSelector = @selector(toggleFullScreen:);
if (![nsWindow respondsToSelector:toggleFullScreenSelector]) return;
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[nsWindow performSelector:toggleFullScreenSelector withObject:nil];
}];
@@ -1181,7 +1133,7 @@
JNF_COCOA_ENTER(env);
NSWindow *nsWindow = OBJC(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
[window setEnabled: isEnabled];
@@ -1196,7 +1148,7 @@
JNF_COCOA_ENTER(env);
NSWindow *nsWindow = OBJC(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
if ([AWTWindow lastKeyWindow] == window) {
--- a/jdk/src/macosx/native/sun/awt/ApplicationDelegate.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/ApplicationDelegate.m Tue Jan 29 20:19:48 2013 -0800
@@ -515,10 +515,9 @@
JNIEXPORT void JNICALL Java_com_apple_eawt_Application_nativeInitializeApplicationDelegate
(JNIEnv *env, jclass clz)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
// Force initialization to happen on AppKit thread!
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[ApplicationDelegate sharedDelegate];
}];
JNF_COCOA_EXIT(env);
@@ -532,10 +531,9 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppEventHandler_nativeOpenCocoaAboutWindow
(JNIEnv *env, jclass clz)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[NSApp orderFrontStandardAboutPanel:nil];
}];
@@ -550,10 +548,9 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppEventHandler_nativeReplyToAppShouldTerminate
(JNIEnv *env, jclass clz, jboolean doTerminate)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[NSApp replyToApplicationShouldTerminate:doTerminate];
}];
@@ -568,7 +565,6 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppEventHandler_nativeRegisterForNotification
(JNIEnv *env, jclass clz, jint notificationType)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
[ThreadUtilities performOnMainThread:@selector(_registerForNotification:)
onObject:[ApplicationDelegate class]
@@ -586,13 +582,10 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppDockIconHandler_nativeSetDockMenu
(JNIEnv *env, jclass clz, jlong nsMenuPtr)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
NSMenu *menu = (NSMenu *)jlong_to_ptr(nsMenuPtr);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
[ApplicationDelegate sharedDelegate].fDockMenu = menu;
}];
@@ -607,14 +600,13 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppDockIconHandler_nativeSetDockIconImage
(JNIEnv *env, jclass clz, jlong nsImagePtr)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
NSImage *_image = (NSImage *)jlong_to_ptr(nsImagePtr);
- [JNFRunLoop performOnMainThread:@selector(_setDockIconImage:)
- on:[ApplicationDelegate class]
- withObject:_image
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(_setDockIconImage:)
+ on:[ApplicationDelegate class]
+ withObject:_image
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -629,12 +621,9 @@
{
__block NSImage *image = nil;
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
image = [ApplicationDelegate _dockIconImage];
CFRetain(image);
}];
@@ -652,13 +641,10 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppDockIconHandler_nativeSetDockIconBadge
(JNIEnv *env, jclass clz, jstring badge)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
NSString *badgeString = JNFJavaToNSString(env, badge);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
NSDockTile *dockTile = [NSApp dockTile];
[dockTile setBadgeLabel:badgeString];
[dockTile display];
@@ -675,12 +661,9 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppMiscHandlers_nativeRequestActivation
(JNIEnv *env, jclass clz, jboolean allWindows)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
NSApplicationActivationOptions options = allWindows ? NSApplicationActivateAllWindows : 0;
options |= NSApplicationActivateIgnoringOtherApps; // without this, nothing happens!
[[NSRunningApplication currentApplication] activateWithOptions:options];
@@ -697,12 +680,9 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppMiscHandlers_nativeRequestUserAttention
(JNIEnv *env, jclass clz, jboolean critical)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[NSApp requestUserAttention:critical ? NSCriticalRequest : NSInformationalRequest];
}];
@@ -717,13 +697,12 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppMiscHandlers_nativeOpenHelpViewer
(JNIEnv *env, jclass clz)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThread:@selector(showHelp:)
- on:NSApp
- withObject:nil
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(showHelp:)
+ on:NSApp
+ withObject:nil
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -736,7 +715,6 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppMiscHandlers_nativeEnableSuddenTermination
(JNIEnv *env, jclass clz)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
[[NSProcessInfo processInfo] enableSuddenTermination]; // Foundation thread-safe
@@ -752,7 +730,6 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppMiscHandlers_nativeDisableSuddenTermination
(JNIEnv *env, jclass clz)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
[[NSProcessInfo processInfo] disableSuddenTermination]; // Foundation thread-safe
@@ -768,12 +745,9 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppMenuBarHandler_nativeSetMenuState
(JNIEnv *env, jclass clz, jint menuID, jboolean visible, jboolean enabled)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
ApplicationDelegate *delegate = [ApplicationDelegate sharedDelegate];
switch (menuID) {
case com_apple_eawt__AppMenuBarHandler_MENU_ABOUT:
@@ -796,12 +770,10 @@
JNIEXPORT void JNICALL Java_com_apple_eawt__1AppMenuBarHandler_nativeSetDefaultMenuBar
(JNIEnv *env, jclass clz, jlong cMenuBarPtr)
{
-AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
CMenuBar *menu = (CMenuBar *)jlong_to_ptr(cMenuBarPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[ApplicationDelegate sharedDelegate].fDefaultMenuBar = menu;
}];
--- a/jdk/src/macosx/native/sun/awt/CClipboard.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CClipboard.m Tue Jan 29 20:19:48 2013 -0800
@@ -109,7 +109,6 @@
}
- (void) javaDeclareTypes:(NSArray *)inTypes withOwner:(jobject)inClipboard jniEnv:(JNIEnv *)inEnv {
- AWT_ASSERT_NOT_APPKIT_THREAD;
//NSLog(@"CClipboard javaDeclareTypes %@ withOwner", inTypes);
@@ -134,7 +133,6 @@
- (NSArray *) javaGetTypes {
- AWT_ASSERT_NOT_APPKIT_THREAD;
NSMutableArray *args = [NSMutableArray arrayWithCapacity:1];
[ThreadUtilities performOnMainThread:@selector(_nativeGetTypes:) onObject:self withObject:args waitUntilDone:YES awtMode:YES];
@@ -152,7 +150,6 @@
}
- (void) javaSetData:(NSData *)inData forType:(NSString *) inFormat {
- AWT_ASSERT_NOT_APPKIT_THREAD;
CClipboardUpdate *newUpdate = [[CClipboardUpdate alloc] initWithData:inData withFormat:inFormat];
[ThreadUtilities performOnMainThread:@selector(_nativeSetData:) onObject:self withObject:newUpdate waitUntilDone:YES awtMode:YES];
@@ -171,7 +168,6 @@
}
- (NSData *) javaGetDataForType:(NSString *) inFormat {
- AWT_ASSERT_NOT_APPKIT_THREAD;
NSMutableArray *args = [NSMutableArray arrayWithObject:inFormat];
[ThreadUtilities performOnMainThread:@selector(_nativeGetDataForType:) onObject:self withObject:args waitUntilDone:YES awtMode:YES];
--- a/jdk/src/macosx/native/sun/awt/CCursorManager.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CCursorManager.m Tue Jan 29 20:19:48 2013 -0800
@@ -74,7 +74,6 @@
(JNIEnv *env, jclass class, jint type, jstring name)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSString *cursorName = JNFJavaToNSString(env, name);
SEL cursorSelector = (type == sun_lwawt_macosx_CCursorManager_NAMED_CURSOR) ? lookupCursorSelectorForName(cursorName) : lookupCursorSelectorForType(type);
@@ -87,9 +86,7 @@
[JNFException raise:env as:kNoSuchMethodException reason:"missing NSCursor selector"];
}
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
setCursorOnAppKitThread([[NSCursor class] performSelector:cursorSelector]);
}];
@@ -101,12 +98,9 @@
(JNIEnv *env, jclass class, jlong imgPtr, jdouble x, jdouble y)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSImage *image = (NSImage *)jlong_to_ptr(imgPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
NSCursor *cursor = [[NSCursor alloc] initWithImage:image
hotSpot:(NSPoint){ x, y }];
setCursorOnAppKitThread(cursor);
@@ -127,8 +121,6 @@
__block NSPoint pt = NSZeroPoint;
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
pt = ConvertNSScreenPoint(env, [NSEvent mouseLocation]);
}];
@@ -144,13 +136,11 @@
Java_sun_lwawt_macosx_CCursorManager_nativeSetAllowsCursorSetInBackground
(JNIEnv *env, jclass class, jboolean allows)
{
-
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
SEL allowsSetInBackground_SEL = @selector(javaSetAllowsCursorSetInBackground:);
if ([[NSCursor class] respondsToSelector:allowsSetInBackground_SEL]) {
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
NSMethodSignature *allowsSetInBackground_sig =
[[NSCursor class] methodSignatureForSelector:allowsSetInBackground_SEL];
NSInvocation *invocation =
--- a/jdk/src/macosx/native/sun/awt/CDesktopPeer.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CDesktopPeer.m Tue Jan 29 20:19:48 2013 -0800
@@ -36,8 +36,6 @@
JNIEXPORT jint JNICALL Java_sun_lwawt_macosx_CDesktopPeer__1lsOpenURI
(JNIEnv *env, jclass clz, jstring uri)
{
- // AWT_ASSERT_ANY_THREAD
-
OSStatus status = noErr;
JNF_COCOA_ENTER(env);
@@ -63,8 +61,6 @@
JNIEXPORT jint JNICALL Java_sun_lwawt_macosx_CDesktopPeer__1lsOpenFile
(JNIEnv *env, jclass clz, jstring jpath, jboolean print)
{
- // AWT_ASSERT_ANY_THREAD
-
OSStatus status = noErr;
JNF_COCOA_ENTER(env);
--- a/jdk/src/macosx/native/sun/awt/CDragSourceContextPeer.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CDragSourceContextPeer.m Tue Jan 29 20:19:48 2013 -0800
@@ -46,7 +46,7 @@
__block CDragSource* dragSource = nil;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
dragSource = [[CDragSource alloc] init:jthis component:jcomponent peer:jpeer control:controlObj
transferable:jtransferable triggerEvent:jtrigger dragPosX:jdragposx
dragPosY:jdragposy modifiers:jextmodifiers clickCount:jclickcount timeStamp:jtimestamp
@@ -103,7 +103,7 @@
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_setNativeCursor
(JNIEnv *env, jobject jthis, jlong nativeDragSourceVal, jobject jcursor, jint jcursortype)
{
- AWT_ASSERT_NOT_APPKIT_THREAD;
+ //AWT_ASSERT_NOT_APPKIT_THREAD;
//JNF_COCOA_ENTER(env);
// jobject gCursor = JNFNewGlobalRef(env, jcursor);
--- a/jdk/src/macosx/native/sun/awt/CImage.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CImage.m Tue Jan 29 20:19:48 2013 -0800
@@ -108,7 +108,6 @@
jlong result = 0L;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_ANY_THREAD;
NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, width, height);
if (imageRep) {
@@ -139,7 +138,6 @@
jlong result = 0L;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_ANY_THREAD;
jsize num = (*env)->GetArrayLength(env, buffers);
NSMutableArray * reps = [NSMutableArray arrayWithCapacity: num];
@@ -187,7 +185,6 @@
NSImage *image = nil;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_ANY_THREAD;
IconRef iconRef;
if (noErr == GetIconRef(kOnSystemDisk, kSystemIconsCreator, selector, &iconRef)) {
@@ -212,7 +209,6 @@
NSImage *image = nil;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_ANY_THREAD;
NSString *path = JNFNormalizedNSStringForPath(env, file);
image = [[NSImage alloc] initByReferencingFile:path];
@@ -234,10 +230,9 @@
__block NSImage *image = nil;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_ANY_THREAD;
NSString *path = JNFNormalizedNSStringForPath(env, file);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
image = [[NSWorkspace sharedWorkspace] iconForFile:path];
[image setScalesWhenResized:TRUE];
if (image) CFRetain(image); // GC
@@ -259,7 +254,6 @@
NSImage *image = nil;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_ANY_THREAD;
image = [NSImage imageNamed:JNFJavaToNSString(env, name)];
if (image) CFRetain(image); // GC
@@ -278,7 +272,6 @@
(JNIEnv *env, jclass klass, jlong nsImgPtr, jintArray buffer, jint w, jint h)
{
JNF_COCOA_ENTER(env);
-AWT_ASSERT_ANY_THREAD;
NSImage *img = (NSImage *)jlong_to_ptr(nsImgPtr);
jint *dst = (*env)->GetPrimitiveArrayCritical(env, buffer, NULL);
@@ -301,7 +294,6 @@
jobject size = NULL;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_ANY_THREAD;
size = NSToJavaSize(env, [(NSImage *)jlong_to_ptr(nsImgPtr) size]);
--- a/jdk/src/macosx/native/sun/awt/CInputMethod.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CInputMethod.m Tue Jan 29 20:19:48 2013 -0800
@@ -153,7 +153,7 @@
__block NSString *keyboardInfo = NULL;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
keyboardInfo = [inputMethodController performSelector:@selector(currentInputMethodName)];
[keyboardInfo retain];
}];
@@ -177,7 +177,7 @@
JNF_COCOA_ENTER(env);
AWTView *view = (AWTView *)jlong_to_ptr(nativePeer);
JNFJObjectWrapper *inputMethodWrapper = [[JNFJObjectWrapper alloc] initWithJObject:inputMethod withEnv:env];
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[CInputMethod _nativeNotifyPeerWithView:view inputMethod:inputMethodWrapper];
}];
@@ -196,7 +196,7 @@
JNF_COCOA_ENTER(env);
AWTView *view = (AWTView *)jlong_to_ptr(nativePeer);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[CInputMethod _nativeEndComposition:view];
}];
@@ -216,7 +216,7 @@
__block NSString *isoAbbreviation;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
isoAbbreviation = (NSString *) [inputMethodController performSelector:@selector(currentInputMethodLocale)];
[isoAbbreviation retain];
}];
@@ -259,7 +259,7 @@
NSString *localeStr = JNFJavaToNSString(env, locale);
[localeStr retain];
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
[CInputMethod setKeyboardLayout:localeStr];
}];
@@ -293,7 +293,7 @@
__block NSArray *selectableArray = nil;
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
selectableArray = (NSArray *)[inputMethodController performSelector:@selector(availableInputMethodLocales)];
[selectableArray retain];
}];
--- a/jdk/src/macosx/native/sun/awt/CMenu.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CMenu.m Tue Jan 29 20:19:48 2013 -0800
@@ -55,12 +55,10 @@
//- (void)finalize { [super finalize]; }
- (void)addJavaSubmenu:(CMenu *)submenu {
-AWT_ASSERT_NOT_APPKIT_THREAD;
[ThreadUtilities performOnMainThread:@selector(addNativeItem_OnAppKitThread:) onObject:self withObject:submenu waitUntilDone:YES awtMode:YES];
}
- (void)addJavaMenuItem:(CMenuItem *)theMenuItem {
-AWT_ASSERT_NOT_APPKIT_THREAD;
[ThreadUtilities performOnMainThread:@selector(addNativeItem_OnAppKitThread:) onObject:self withObject:theMenuItem waitUntilDone:YES awtMode:YES];
}
@@ -70,7 +68,6 @@
}
- (void)setJavaMenuTitle:(NSString *)title {
-AWT_ASSERT_NOT_APPKIT_THREAD;
if (title) {
[ThreadUtilities performOnMainThread:@selector(setNativeMenuTitle_OnAppKitThread:) onObject:self withObject:title waitUntilDone:YES awtMode:YES];
@@ -95,7 +92,6 @@
}
- (void)deleteJavaItem:(jint)index {
-AWT_ASSERT_NOT_APPKIT_THREAD;
[ThreadUtilities performOnMainThread:@selector(deleteNativeJavaItem_OnAppKitThread:) onObject:self withObject:[NSNumber numberWithInt:index] waitUntilDone:YES awtMode:YES];
}
--- a/jdk/src/macosx/native/sun/awt/CMenuComponent.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CMenuComponent.m Tue Jan 29 20:19:48 2013 -0800
@@ -80,10 +80,10 @@
{
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThread:@selector(disposer)
- on:((id)jlong_to_ptr(menuItemObj))
- withObject:nil
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(disposer)
+ on:((id)jlong_to_ptr(menuItemObj))
+ withObject:nil
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
--- a/jdk/src/macosx/native/sun/awt/CMenuItem.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CMenuItem.m Tue Jan 29 20:19:48 2013 -0800
@@ -104,7 +104,6 @@
}
- (void) setJavaLabel:(NSString *)theLabel shortcut:(NSString *)theKeyEquivalent modifierMask:(jint)modifiers {
-AWT_ASSERT_NOT_APPKIT_THREAD;
NSUInteger modifierMask = 0;
@@ -126,8 +125,7 @@
modifierMask = JavaModifiersToNsKeyModifiers(modifiers, NO);
}
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
[fMenuItem setKeyEquivalent:theKeyEquivalent];
[fMenuItem setKeyEquivalentModifierMask:modifierMask];
[fMenuItem setTitle:theLabel];
@@ -135,32 +133,23 @@
}
- (void) setJavaImage:(NSImage *)theImage {
-AWT_ASSERT_NOT_APPKIT_THREAD;
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[fMenuItem setImage:theImage];
}];
}
- (void) setJavaToolTipText:(NSString *)theText {
-AWT_ASSERT_NOT_APPKIT_THREAD;
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[fMenuItem setToolTip:theText];
}];
}
- (void)setJavaEnabled:(BOOL) enabled {
-AWT_ASSERT_NOT_APPKIT_THREAD;
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
@synchronized(self) {
fIsEnabled = enabled;
@@ -173,7 +162,6 @@
}
- (BOOL)isEnabled {
- // AWT_ASSERT_ANY_THREAD;
BOOL enabled = NO;
@synchronized(self) {
@@ -184,11 +172,8 @@
- (void)setJavaState:(BOOL)newState {
-AWT_ASSERT_NOT_APPKIT_THREAD;
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
-AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[fMenuItem setState:(newState ? NSOnState : NSOffState)];
}];
}
--- a/jdk/src/macosx/native/sun/awt/CPopupMenu.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CPopupMenu.m Tue Jan 29 20:19:48 2013 -0800
@@ -64,7 +64,7 @@
jobject cPeerObjGlobal = JNFNewGlobalRef(env, peer);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
aCPopupMenu = [[CPopupMenu alloc] initWithPeer:cPeerObjGlobal];
CFRetain(aCPopupMenu);
[aCPopupMenu release];
@@ -82,7 +82,7 @@
CPopupMenu* cPopupMenu = (CPopupMenu*)jlong_to_ptr(menuPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
NSPoint loc = ConvertNSScreenPoint(env, NSMakePoint(x, y));
[[cPopupMenu menu] popUpMenuPositioningItem: nil
--- a/jdk/src/macosx/native/sun/awt/CTrayIcon.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CTrayIcon.m Tue Jan 29 20:19:48 2013 -0800
@@ -303,10 +303,9 @@
__block AWTTrayIcon *trayIcon = nil;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
jobject thePeer = JNFNewGlobalRef(env, peer);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
trayIcon = [[AWTTrayIcon alloc] initWithPeer:thePeer];
}];
@@ -334,11 +333,10 @@
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CTrayIcon_nativeSetToolTip
(JNIEnv *env, jobject self, jlong model, jstring jtooltip) {
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
AWTTrayIcon *icon = jlong_to_ptr(model);
NSString *tooltip = JNFJavaToNSString(env, jtooltip);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[icon setTooltip:tooltip];
}];
@@ -353,10 +351,9 @@
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CTrayIcon_setNativeImage
(JNIEnv *env, jobject self, jlong model, jlong imagePtr, jboolean autosize) {
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
AWTTrayIcon *icon = jlong_to_ptr(model);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
[icon setImage:jlong_to_ptr(imagePtr) sizing:autosize];
}];
@@ -369,13 +366,10 @@
jobject jpt = NULL;
JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
__block NSPoint pt = NSZeroPoint;
AWTTrayIcon *icon = jlong_to_ptr(model);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
- AWT_ASSERT_APPKIT_THREAD;
-
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
NSPoint loc = [icon getLocationOnScreen];
pt = ConvertNSScreenPoint(env, loc);
}];
--- a/jdk/src/macosx/native/sun/awt/CWrapper.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/CWrapper.m Tue Jan 29 20:19:48 2013 -0800
@@ -46,7 +46,7 @@
JNF_COCOA_ENTER(env);
id obj = (id)jlong_to_ptr(objectPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
CFRelease(obj);
}];
@@ -66,10 +66,10 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThread:@selector(makeKeyAndOrderFront:)
- on:window
- withObject:nil
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(makeKeyAndOrderFront:)
+ on:window
+ withObject:nil
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -86,10 +86,10 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThread:@selector(makeKeyWindow)
- on:window
- withObject:nil
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(makeKeyWindow)
+ on:window
+ withObject:nil
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -106,10 +106,10 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThread:@selector(makeMainWindow)
- on:window
- withObject:nil
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(makeMainWindow)
+ on:window
+ withObject:nil
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -128,7 +128,7 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
canBecomeMainWindow = [window canBecomeMainWindow];
}];
@@ -151,7 +151,7 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
isKeyWindow = [window isKeyWindow];
}];
@@ -172,10 +172,10 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThread:@selector(orderFront:)
- on:window
- withObject:window
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(orderFront:)
+ on:window
+ withObject:window
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -192,10 +192,10 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThread:@selector(orderOut:)
- on:window
- withObject:window
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(orderOut:)
+ on:window
+ withObject:window
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -212,10 +212,10 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThread:@selector(orderFrontRegardless)
- on:window
- withObject:nil
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(orderFrontRegardless)
+ on:window
+ withObject:nil
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -233,7 +233,7 @@
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
NSWindow *relativeTo = (NSWindow *)jlong_to_ptr(relativeToPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window orderWindow:(NSWindowOrderingMode)order relativeTo:[relativeTo windowNumber]];
}];
@@ -267,7 +267,7 @@
initLevels();
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setLevel: LEVELS[level]];
}];
} else {
@@ -290,7 +290,7 @@
NSWindow *parent = (NSWindow *)jlong_to_ptr(parentPtr);
NSWindow *child = (NSWindow *)jlong_to_ptr(childPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[parent addChildWindow:child ordered:order];
}];
@@ -310,10 +310,10 @@
AWTWindow *parent = (AWTWindow *)jlong_to_ptr(parentPtr);
AWTWindow *child = (AWTWindow *)jlong_to_ptr(childPtr);
- [JNFRunLoop performOnMainThread:@selector(removeChildWindow:)
- on:parent
- withObject:child
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(removeChildWindow:)
+ on:parent
+ withObject:child
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -331,7 +331,7 @@
AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
NSRect frame = NSMakeRect(x, y, w, h);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setFrame:frame display:display];
}];
@@ -350,7 +350,7 @@
JNF_COCOA_ENTER(env);
AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setAlphaValue:(CGFloat)alpha];
}];
@@ -369,7 +369,7 @@
JNF_COCOA_ENTER(env);
AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setOpaque:(BOOL)opaque];
}];
@@ -389,7 +389,7 @@
AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
NSColor *color = (NSColor *)jlong_to_ptr(colorPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setBackgroundColor:color];
}];
@@ -410,7 +410,7 @@
JNF_COCOA_ENTER(env);
AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
const NSScreen *screen = [window screen];
CFRetain(screen); // GC
screenPtr = ptr_to_jlong(screen);
@@ -432,10 +432,10 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThread:@selector(miniaturize:)
- on:window
- withObject:nil
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(miniaturize:)
+ on:window
+ withObject:nil
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -452,10 +452,10 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThread:@selector(deminiaturize:)
- on:window
- withObject:nil
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(deminiaturize:)
+ on:window
+ withObject:nil
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -472,10 +472,10 @@
JNF_COCOA_ENTER(env);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
- [JNFRunLoop performOnMainThread:@selector(zoom:)
- on:window
- withObject:nil
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(zoom:)
+ on:window
+ withObject:nil
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -493,10 +493,10 @@
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
NSResponder *responder = (NSResponder *)jlong_to_ptr(responderPtr);
- [JNFRunLoop performOnMainThread:@selector(makeFirstResponder:)
- on:window
- withObject:responder
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(makeFirstResponder:)
+ on:window
+ withObject:responder
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -514,7 +514,7 @@
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
NSView *subview = (NSView *)jlong_to_ptr(subviewPtr);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
[view addSubview:subview];
}];
@@ -533,10 +533,10 @@
JNF_COCOA_ENTER(env);
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
- [JNFRunLoop performOnMainThread:@selector(removeFromSuperview)
- on:view
- withObject:nil
- waitUntilDone:NO];
+ [ThreadUtilities performOnMainThread:@selector(removeFromSuperview)
+ on:view
+ withObject:nil
+ waitUntilDone:NO];
JNF_COCOA_EXIT(env);
}
@@ -553,7 +553,7 @@
JNF_COCOA_ENTER(env);
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[view setFrame:NSMakeRect(x, y, w, h)];
}];
@@ -576,7 +576,7 @@
__block NSRect rect = NSZeroRect;
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
rect = [view frame];
}];
@@ -599,7 +599,7 @@
JNF_COCOA_ENTER(env);
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
NSScreen *screen = [[view window] screen];
NSDictionary *opts = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], NSFullScreenModeAllScreens, nil];
[view enterFullScreenMode:screen withOptions:opts];
@@ -620,7 +620,7 @@
JNF_COCOA_ENTER(env);
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[view exitFullScreenModeWithOptions:nil];
}];
@@ -641,7 +641,7 @@
JNF_COCOA_ENTER(env);
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
windowPtr = ptr_to_jlong([view window]);
}];
@@ -655,14 +655,14 @@
* Method: setHidden
* Signature: (JZ)V
*/
-JNIEXPORT jlong JNICALL
+JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSView_setHidden
(JNIEnv *env, jclass cls, jlong viewPtr, jboolean toHide)
{
JNF_COCOA_ENTER(env);
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[view setHidden:(BOOL)toHide];
}];
@@ -686,7 +686,7 @@
__block NSRect rect = NSZeroRect;
NSScreen *screen = (NSScreen *)jlong_to_ptr(screenPtr);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
rect = [screen frame];
}];
@@ -713,7 +713,7 @@
__block NSRect rect = NSZeroRect;
NSScreen *screen = (NSScreen *)jlong_to_ptr(screenPtr);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
rect = [screen visibleFrame];
}];
@@ -737,7 +737,7 @@
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
NSArray *screens = [NSScreen screens];
for (NSScreen *screen in screens) {
NSDictionary *screenInfo = [screen deviceDescription];
@@ -768,7 +768,7 @@
JNF_COCOA_ENTER(env);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
clearColorPtr = ptr_to_jlong([NSColor clearColor]);
}];
--- a/jdk/src/macosx/native/sun/awt/JavaComponentAccessibility.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/JavaComponentAccessibility.m Tue Jan 29 20:19:48 2013 -0800
@@ -1147,7 +1147,6 @@
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CAccessibility_focusChanged
(JNIEnv *env, jobject jthis)
{
- AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
[ThreadUtilities performOnMainThread:@selector(postFocusChanged:) onObject:[JavaComponentAccessibility class] withObject:nil waitUntilDone:NO awtMode:NO];
@@ -1164,7 +1163,6 @@
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CAccessible_valueChanged
(JNIEnv *env, jclass jklass, jlong element)
{
- AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
[ThreadUtilities performOnMainThread:@selector(postValueChanged) onObject:(JavaComponentAccessibility *)jlong_to_ptr(element) withObject:nil waitUntilDone:NO awtMode:NO];
JNF_COCOA_EXIT(env);
@@ -1178,7 +1176,6 @@
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CAccessible_selectionChanged
(JNIEnv *env, jclass jklass, jlong element)
{
- AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
[ThreadUtilities performOnMainThread:@selector(postSelectionChanged) onObject:(JavaComponentAccessibility *)jlong_to_ptr(element) withObject:nil waitUntilDone:NO awtMode:NO];
JNF_COCOA_EXIT(env);
@@ -1193,7 +1190,6 @@
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CAccessible_unregisterFromCocoaAXSystem
(JNIEnv *env, jclass jklass, jlong element)
{
- AWT_ASSERT_NOT_APPKIT_THREAD;
JNF_COCOA_ENTER(env);
[ThreadUtilities performOnMainThread:@selector(unregisterFromCocoaAXSystem) onObject:(JavaComponentAccessibility *)jlong_to_ptr(element) withObject:nil waitUntilDone:NO awtMode:NO];
JNF_COCOA_EXIT(env);
--- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m Tue Jan 29 20:19:48 2013 -0800
@@ -415,13 +415,9 @@
JNF_COCOA_ENTER(env);
- if ([NSThread isMainThread]) {
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^() {
active = (jboolean)[NSRunningApplication currentApplication].active;
- } else {
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() {
- active = (jboolean)[NSRunningApplication currentApplication].active;
- }];
- }
+ }];
JNF_COCOA_EXIT(env);
--- a/jdk/src/macosx/native/sun/awt/awt.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/awt/awt.m Tue Jan 29 20:19:48 2013 -0800
@@ -42,6 +42,15 @@
// The symbol is defined in libosxapp.dylib (ThreadUtilities.m)
extern JavaVM *jvm;
+// Indicates if AWT is running embedded (in SWT, FX, elsewhere)
+static BOOL isEmbedded = NO;
+
+// Indicates that the app has been started with -XstartOnFirstThread
+// (directly or via WebStart settings), and AWT should not run its
+// own event loop in this mode. Even if a loop isn't running yet,
+// we expect an embedder (e.g. SWT) to start it some time later.
+static BOOL forceEmbeddedMode = NO;
+
static bool ShouldPrintVerboseDebugging() {
static int debug = -1;
if (debug == -1) {
@@ -63,31 +72,29 @@
static CFRunLoopObserverRef busyObserver = NULL;
static CFRunLoopObserverRef notBusyObserver = NULL;
-static void setUpAWTAppKit(BOOL swt_mode, BOOL headless) {
-AWT_ASSERT_APPKIT_THREAD;
+static void setUpAWTAppKit()
+{
BOOL verbose = ShouldPrintVerboseDebugging();
if (verbose) AWT_DEBUG_LOG(@"setting up busy observers");
- JNIEnv *env = [ThreadUtilities getJNIEnv];
-
// Add CFRunLoopObservers to call into AWT so that AWT knows that the
// AWT thread (which is the AppKit main thread) is alive. This way AWT
// will not automatically shutdown.
busyObserver = CFRunLoopObserverCreate(
- NULL, // CFAllocator
- kCFRunLoopAfterWaiting, // CFOptionFlags
- true, // repeats
- NSIntegerMax, // order
- &BusyObserver, // CFRunLoopObserverCallBack
- NULL); // CFRunLoopObserverContext
+ NULL, // CFAllocator
+ kCFRunLoopAfterWaiting, // CFOptionFlags
+ true, // repeats
+ NSIntegerMax, // order
+ &BusyObserver, // CFRunLoopObserverCallBack
+ NULL); // CFRunLoopObserverContext
notBusyObserver = CFRunLoopObserverCreate(
- NULL, // CFAllocator
- kCFRunLoopBeforeWaiting, // CFOptionFlags
- true, // repeats
- NSIntegerMin, // order
- &NotBusyObserver, // CFRunLoopObserverCallBack
- NULL); // CFRunLoopObserverContext
+ NULL, // CFAllocator
+ kCFRunLoopBeforeWaiting, // CFOptionFlags
+ true, // repeats
+ NSIntegerMin, // order
+ &NotBusyObserver, // CFRunLoopObserverCallBack
+ NULL); // CFRunLoopObserverContext
CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
CFRunLoopAddObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
@@ -95,29 +102,33 @@
CFRelease(busyObserver);
CFRelease(notBusyObserver);
-
- if (!headless) setBusy(YES);
+
+ setBusy(YES);
+}
+
+static void setUpAppKitThreadName()
+{
+ BOOL verbose = ShouldPrintVerboseDebugging();
+ JNIEnv *env = [ThreadUtilities getJNIEnv];
// Set the java name of the AppKit main thread appropriately.
jclass threadClass = NULL;
jstring name = NULL;
jobject curThread = NULL;
- if (!swt_mode) {
- threadClass = (*env)->FindClass(env, "java/lang/Thread");
- if (threadClass == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
- jmethodID currentThreadID = (*env)->GetStaticMethodID(env, threadClass, "currentThread", "()Ljava/lang/Thread;");
- if (currentThreadID == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
- jmethodID setName = (*env)->GetMethodID(env, threadClass, "setName", "(Ljava/lang/String;)V");
- if (setName == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
+ threadClass = (*env)->FindClass(env, "java/lang/Thread");
+ if (threadClass == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
+ jmethodID currentThreadID = (*env)->GetStaticMethodID(env, threadClass, "currentThread", "()Ljava/lang/Thread;");
+ if (currentThreadID == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
+ jmethodID setName = (*env)->GetMethodID(env, threadClass, "setName", "(Ljava/lang/String;)V");
+ if (setName == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
- curThread = (*env)->CallStaticObjectMethod(env, threadClass, currentThreadID); // AWT_THREADING Safe (known object)
- if (curThread == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
- name = (*env)->NewStringUTF(env, "AWT-AppKit");
- if (name == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
- (*env)->CallVoidMethod(env, curThread, setName, name); // AWT_THREADING Safe (known object)
- if ((*env)->ExceptionCheck(env)) goto cleanup;
- }
+ curThread = (*env)->CallStaticObjectMethod(env, threadClass, currentThreadID); // AWT_THREADING Safe (known object)
+ if (curThread == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
+ name = (*env)->NewStringUTF(env, "AWT-AppKit");
+ if (name == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
+ (*env)->CallVoidMethod(env, curThread, setName, name); // AWT_THREADING Safe (known object)
+ if ((*env)->ExceptionCheck(env)) goto cleanup;
cleanup:
if (threadClass != NULL) {
@@ -134,14 +145,10 @@
(*env)->ExceptionClear(env);
}
- // Add the exception handler of last resort
- NSSetUncaughtExceptionHandler(AWT_NSUncaughtExceptionHandler);
-
if (verbose) AWT_DEBUG_LOG(@"finished setting thread name");
}
-
// Returns true if java believes it is running headless
BOOL isHeadless(JNIEnv *env) {
// Just access the property directly, instead of using GraphicsEnvironment.isHeadless.
@@ -200,7 +207,7 @@
// This is an empty Obj-C object just so that -peformSelectorOnMainThread can be used.
@interface AWTStarter : NSObject { }
-+ (void)start:(BOOL)headless swtMode:(BOOL)swtMode swtModeForWebStart:(BOOL)swtModeForWebStart;
++ (void)start:(BOOL)headless;
- (void)starter:(NSArray*)args;
+ (void)appKitIsRunning:(id)arg;
@end
@@ -242,7 +249,7 @@
if (verbose) AWT_DEBUG_LOG(@"finished messaging AppKit started");
}
-+ (void)start:(BOOL)headless swtMode:(BOOL)swtMode swtModeForWebStart:(BOOL)swtModeForWebStart
++ (void)start:(BOOL)headless
{
BOOL verbose = ShouldPrintVerboseDebugging();
@@ -258,7 +265,7 @@
BOOL onMainThread = (pthread_main_np() != 0);
if (verbose) {
- NSString *msg = [NSString stringWithFormat:@"+[AWTStarter start headless:%d swtMode:%d swtModeForWebStart:%d] { onMainThread:%d }", headless, swtMode, swtModeForWebStart, onMainThread];
+ NSString *msg = [NSString stringWithFormat:@"+[AWTStarter start headless:%d] { onMainThread:%d }", headless, onMainThread];
AWT_DEBUG_LOG(msg);
}
@@ -280,9 +287,7 @@
NSArray * args = [NSArray arrayWithObjects:
[NSNumber numberWithBool: onMainThread],
- [NSNumber numberWithBool: swtMode],
[NSNumber numberWithBool: headless],
- [NSNumber numberWithBool: swtModeForWebStart],
[NSNumber numberWithBool: verbose],
nil];
@@ -310,39 +315,38 @@
// Don't set the delegate until the NSApplication has been created and
// its finishLaunching has initialized it.
// ApplicationDelegate is the support code for com.apple.eawt.
- void (^setDelegateBlock)() = ^(){
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]);
- };
- if (onMainThread) {
- setDelegateBlock();
- } else {
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:setDelegateBlock];
- }
+ }];
}
- (void)starter:(NSArray*)args {
NSAutoreleasePool *pool = [NSAutoreleasePool new];
BOOL onMainThread = [[args objectAtIndex:0] boolValue];
- BOOL swtMode = [[args objectAtIndex:1] boolValue];
- BOOL headless = [[args objectAtIndex:2] boolValue];
- BOOL swtModeForWebStart = [[args objectAtIndex:3] boolValue];
- BOOL verbose = [[args objectAtIndex:4] boolValue];
+ BOOL headless = [[args objectAtIndex:1] boolValue];
+ BOOL verbose = [[args objectAtIndex:2] boolValue];
BOOL wasOnMainThread = onMainThread;
- setUpAWTAppKit(swtMode, headless);
+ // Add the exception handler of last resort
+ NSSetUncaughtExceptionHandler(AWT_NSUncaughtExceptionHandler);
// Headless mode trumps either ordinary AWT or SWT-in-AWT mode. Declare us a daemon and return.
if (headless) {
- BOOL didBecomeDaemon = [AWTStarter markAppAsDaemon];
+ if (!forceEmbeddedMode) {
+ setUpAppKitThreadName();
+ }
+ [AWTStarter markAppAsDaemon];
return;
}
- if (swtMode || swtModeForWebStart) {
+ if (forceEmbeddedMode) {
if (verbose) NSLog(@"in SWT or SWT/WebStart mode");
- // The SWT should call NSApplicationLoad, but they don't know a priori that they will be using the AWT, so they don't.
+ // Init a default NSApplication instance instead of the NSApplicationAWT.
+ // Note that [NSApp isRunning] will return YES after that, though
+ // this behavior isn't specified anywhere. We rely on that.
NSApplicationLoad();
}
@@ -351,6 +355,13 @@
// and -[NSApplication isRunning] returns YES, AWT is embedded inside another
// AppKit Application.
NSApplication *app = [NSApplicationAWT sharedApplication];
+ isEmbedded = ![NSApp isKindOfClass:[NSApplicationAWT class]];
+
+ if (!isEmbedded) {
+ // Install run loop observers and set the AppKit Java thread name
+ setUpAWTAppKit();
+ setUpAppKitThreadName();
+ }
// AWT gets to this point BEFORE NSApplicationDidFinishLaunchingNotification is sent.
if (![app isRunning]) {
@@ -360,17 +371,11 @@
[NSApplicationAWT runAWTLoopWithApp: app];
} else {
// We're either embedded, or showing a splash screen
- if (![NSApp isKindOfClass:[NSApplicationAWT class]]) {
+ if (isEmbedded) {
if (verbose) AWT_DEBUG_LOG(@"running embedded");
- // Since we're embedded, no need to be swamping the runloop with the observers.
- CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
- CFRunLoopRemoveObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
- CFRunLoopRemoveObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode);
// We don't track if the runloop is busy, so set it free to let AWT finish when it needs
setBusy(NO);
- busyObserver = NULL;
- notBusyObserver = NULL;
} else {
if (verbose) AWT_DEBUG_LOG(@"running after showing a splash screen");
}
@@ -408,49 +413,28 @@
return JNI_VERSION_1_4;
}
- // The following is true when AWT is attempting to connect to the window server
- // when it isn't set up properly to do so.
- // BOOL AWTLoadFailure = YES; For now we are skipping this check so i'm commenting out this variable as unused
JNF_COCOA_ENTER(env);
- // If -XstartOnFirstThread was used at invocation time, an environment variable will be set.
- // (See java_md.c for the matching setenv call.) When that happens, we assume the SWT will be in use.
- BOOL swt_compatible_mode = NO;
-
+ // Launcher sets this env variable if -XstartOnFirstThread is specified
char envVar[80];
snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
if (getenv(envVar) != NULL) {
- swt_compatible_mode = YES;
+ forceEmbeddedMode = YES;
unsetenv(envVar);
}
- BOOL swt_in_webstart = isSWTInWebStart(env);
- BOOL headless = isHeadless(env);
+ if (isSWTInWebStart(env)) {
+ forceEmbeddedMode = YES;
+ }
- // Make sure we're on the right thread. If not, we still need the JNIEnv to throw an exception.
- if (pthread_main_np() != 0 && !swt_compatible_mode && !headless) {
- AWT_DEBUG_LOG(@"Apple AWT Java VM was loaded on first thread -- can't start AWT.");
- [JNFException raise:env as:kInternalError reason:"Can't start the AWT because Java was started on the first thread. Make sure StartOnFirstThread is "
- "not specified in your application's Info.plist or on the command line"];
- return JNI_VERSION_1_4;
- }
+ BOOL headless = isHeadless(env);
// We need to let Foundation know that this is a multithreaded application, if it isn't already.
if (![NSThread isMultiThreaded]) {
[NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil];
}
-// if (swt_compatible_mode || headless || [AWTStarter isConnectedToWindowServer] || [AWTStarter isRemoteSession]) {
-// No need in this check - we will try to launch AWTStarter anyways - to be able to run GUI application remotely
-// AWTLoadFailure = NO;
-
- [AWTStarter start:headless swtMode:swt_compatible_mode swtModeForWebStart:swt_in_webstart];
-
-// }
-
-/* if (AWTLoadFailure) { // We will not reach this code anyways
- [JNFException raise:env as:kInternalError reason:"Can't connect to window server - not enough permissions."];
- } */
+ [AWTStarter start:headless];
JNF_COCOA_EXIT(env);
--- a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.h Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.h Tue Jan 29 20:19:48 2013 -0800
@@ -98,8 +98,6 @@
} \
} while (0)
-#define AWT_ASSERT_ANY_THREAD
-
#endif /* AWT_THREAD_ASSERTS_MESSAGES */
#ifdef AWT_THREAD_ASSERTS_WAIT
@@ -114,15 +112,12 @@
while (pthread_main_np() != 0) {} \
} while (0)
-#define AWT_ASSERT_ANY_THREAD
-
#endif /* AWT_THREAD_ASSERTS_WAIT */
#else /* AWT_THREAD_ASSERTS */
#define AWT_ASSERT_APPKIT_THREAD do {} while (0)
#define AWT_ASSERT_NOT_APPKIT_THREAD do {} while (0)
-#define AWT_ASSERT_ANY_THREAD
#endif /* AWT_THREAD_ASSERTS */
// --------------------------------------------------------------------------
@@ -139,7 +134,10 @@
+ (JNIEnv*)getJNIEnvUncached;
+ (void)performOnMainThread:(SEL)aSelector onObject:(id)target withObject:(id)arg waitUntilDone:(BOOL)wait awtMode:(BOOL)inAWT;
+
+//Wrappers for the corresponding JNFRunLoop methods with a check for main thread
+ (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block;
++ (void)performOnMainThread:(SEL)aSelector on:(id)target withObject:(id)arg waitUntilDone:(BOOL)wait;
@end
void OSXAPP_SetJavaVM(JavaVM *vm);
--- a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m Tue Jan 29 20:19:48 2013 -0800
@@ -37,27 +37,13 @@
static NSArray *sPerformModes = nil;
static NSArray *sAWTPerformModes = nil;
-static BOOL sCocoaComponentCompatibility = NO;
-static NSTimeInterval sCocoaComponentCompatibilityTimeout = 0.5;
static BOOL sLoggingEnabled = YES;
#ifdef AWT_THREAD_ASSERTS_ENV_ASSERT
int sAWTThreadAsserts = 0;
#endif /* AWT_THREAD_ASSERTS_ENV_ASSERT */
-
-// This is for backward compatibility for those people using CocoaComponent
-// Since we've flipped the AWT threading model for Tiger (10.4), all the rules
-// for CocoaComponent are wrong.
-// So for existing CocoaComponent users, we can't be synchronous.
-// Making things totally asynchronous breaks a _lot_, so we try to be
-// synchronous and time out after a little bit.
-#define NOT_READY 0
-#define READY 1
-#define IN_PROGRESS 2
-
BOOL sInPerformFromJava = NO;
-NSUInteger sPerformCount = 0;
// This class is used so that performSelectorOnMainThread can be
// controlled a little more easily by us. It has 2 roles.
@@ -73,8 +59,6 @@
- (id) initWithTarget:(id)target selector:(SEL)selector arg:(id)arg wait:(BOOL)wait;
- (void) perform;
-- (void) performCompatible;
-- (void) _performCompatible:(NSConditionLock *)resultLock;
@end
@@ -113,8 +97,6 @@
sInPerformFromJava = YES;
}
- sPerformCount++;
-
// Actually do the work (cheat to avoid a method call)
@try {
objc_msgSend(fTarget, fSelector, fArg);
@@ -128,69 +110,6 @@
}
}
}
-
-- (void) performCompatible {
- // We check if we are on the AppKit thread because frequently, apps
- // using CocoaComponent are doing things on the wrong thread!
- if (pthread_main_np()) {
- [fTarget performSelector:fSelector withObject:fArg];
- } else {
- // Setup the lock
- NSConditionLock *resultLock =
- [[NSConditionLock alloc] initWithCondition:NOT_READY];
-
- // Make sure that if we return early, nothing gets released out
- // from under us
- [resultLock retain];
- [fTarget retain];
- [fArg retain];
- [self retain];
- // Do an asynchronous perform to the main thread.
- [self performSelectorOnMainThread:@selector(_performCompatible:)
- withObject:resultLock waitUntilDone:NO modes:sAWTPerformModes];
-
- // Wait for a little bit for it to finish
- [resultLock lockWhenCondition:READY beforeDate:[NSDate dateWithTimeIntervalSinceNow:sCocoaComponentCompatibilityTimeout]];
-
- // If the _performCompatible is actually in progress,
- // we should let it finish
- if ([resultLock condition] == IN_PROGRESS) {
- [resultLock lockWhenCondition:READY];
- }
-
- if ([resultLock condition] == NOT_READY && sLoggingEnabled) {
- NSLog(@"[Java CocoaComponent compatibility mode]: Operation timed out due to possible deadlock: selector '%@' on target '%@' with args '%@'", NSStringFromSelector(fSelector), fTarget, fArg);
- }
-
- [resultLock unlock];
- [resultLock autorelease];
- }
-}
-
-- (void) _performCompatible:(NSConditionLock *)resultLock {
- // notify that the perform is in progress!
- [resultLock lock];
- [resultLock unlockWithCondition:IN_PROGRESS];
-
- sPerformCount++;
-
- // Actually do the work.
- @try {
- [fTarget performSelector:fSelector withObject:fArg];
- } @catch (NSException *e) {
- NSLog(@"*** CPerformer: ignoring exception '%@' raised during performCompatible of selector '%@' on target '%@' with args '%@'", e, NSStringFromSelector(fSelector), fTarget, fArg);
- } @finally {
- // notify done!
- [resultLock lock];
- [resultLock unlockWithCondition:READY];
-
- // Clean up after ourselves
- [resultLock autorelease];
- [fTarget autorelease];
- [fArg autorelease];
- [self autorelease];
- }
-}
@end
@@ -236,13 +155,8 @@
// java event thread without deadlocking. See CToolkit.invokeAndWait.
+ (void)performOnMainThread:(SEL)aSelector onObject:(id)target withObject:(id)arg waitUntilDone:(BOOL)wait awtMode:(BOOL)inAWT {
CPerformer *performer = [[CPerformer alloc] initWithTarget:target selector:aSelector arg:arg wait:wait];
- if (sCocoaComponentCompatibility && wait && inAWT) {
- [performer performCompatible];
- [performer autorelease];
- } else {
- [performer performSelectorOnMainThread:@selector(perform) withObject:nil waitUntilDone:wait modes:((inAWT) ? sAWTPerformModes : sPerformModes)]; // AWT_THREADING Safe (cover method)
- [performer release];
- }
+ [performer performSelectorOnMainThread:@selector(perform) withObject:nil waitUntilDone:wait modes:((inAWT) ? sAWTPerformModes : sPerformModes)]; // AWT_THREADING Safe (cover method)
+ [performer release];
}
+ (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block {
@@ -253,6 +167,14 @@
}
}
++ (void)performOnMainThread:(SEL)aSelector on:(id)target withObject:(id)arg waitUntilDone:(BOOL)wait {
+ if ([NSThread isMainThread] && wait == YES) {
+ [target performSelector:aSelector withObject:arg];
+ } else {
+ [JNFRunLoop performOnMainThread:aSelector on:target withObject:arg waitUntilDone:wait];
+ }
+}
+
@end
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Tue Jan 29 20:19:48 2013 -0800
@@ -787,7 +787,6 @@
"List.font", new FontLazyValue(Region.LIST),
"List.rendererUseUIBorder", Boolean.FALSE,
- "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK},
"Menu.arrowIcon", new GTKStyle.GTKLazyValue(
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getMenuArrowIcon"),
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java Tue Jan 29 20:19:48 2013 -0800
@@ -630,8 +630,10 @@
"Menu.menuPopupOffsetY", new Integer(0),
"Menu.submenuPopupOffsetX", new Integer(-2),
"Menu.submenuPopupOffsetY", new Integer(3),
- "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK,
- KeyEvent.META_MASK},
+ "Menu.shortcutKeys", new int[]{
+ SwingUtilities2.getSystemMnemonicKeyMask(),
+ KeyEvent.META_MASK
+ },
"Menu.cancelMode", "hideMenuTree",
"MenuBar.border", menuBarBorder,
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Tue Jan 29 20:19:48 2013 -0800
@@ -2619,13 +2619,15 @@
private static class FocusColorProperty extends DesktopProperty {
public FocusColorProperty () {
- // Fallback value is never used bacause of the configureValue method doesn't return null
+ // Fallback value is never used because of the configureValue method doesn't return null
super("win.3d.backgroundColor", Color.BLACK);
}
@Override
protected Object configureValue(Object value) {
- if (! ((Boolean)Toolkit.getDefaultToolkit().getDesktopProperty("win.highContrast.on")).booleanValue()){
+ Object highContrastOn = Toolkit.getDefaultToolkit().
+ getDesktopProperty("win.highContrast.on");
+ if (highContrastOn == null || !((Boolean) highContrastOn).booleanValue()) {
return Color.BLACK;
}
return Color.BLACK.equals(value) ? Color.WHITE : Color.BLACK;
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTreeUI.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTreeUI.java Tue Jan 29 20:19:48 2013 -0800
@@ -93,6 +93,11 @@
counter = endRow;
}
}
+
+ if (testRect == null) {
+ return;
+ }
+
tree.scrollRectToVisible(new Rectangle(visRect.x, beginY, 1,
testRect.y + testRect.height-
beginY));
--- a/jdk/src/share/classes/java/awt/Button.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Button.java Tue Jan 29 20:19:48 2013 -0800
@@ -300,7 +300,7 @@
* @since 1.4
*/
public synchronized ActionListener[] getActionListeners() {
- return (ActionListener[]) (getListeners(ActionListener.class));
+ return getListeners(ActionListener.class);
}
/**
--- a/jdk/src/share/classes/java/awt/Checkbox.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Checkbox.java Tue Jan 29 20:19:48 2013 -0800
@@ -470,7 +470,7 @@
* @since 1.4
*/
public synchronized ItemListener[] getItemListeners() {
- return (ItemListener[]) (getListeners(ItemListener.class));
+ return getListeners(ItemListener.class);
}
/**
--- a/jdk/src/share/classes/java/awt/Choice.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Choice.java Tue Jan 29 20:19:48 2013 -0800
@@ -85,7 +85,7 @@
* @see #insert(String, int)
* @see #remove(String)
*/
- Vector pItems;
+ Vector<String> pItems;
/**
* The index of the current choice for this <code>Choice</code>
@@ -129,7 +129,7 @@
*/
public Choice() throws HeadlessException {
GraphicsEnvironment.checkHeadless();
- pItems = new Vector();
+ pItems = new Vector<>();
}
/**
@@ -191,7 +191,7 @@
* be called on the toolkit thread.
*/
final String getItemImpl(int index) {
- return (String)pItems.elementAt(index);
+ return pItems.elementAt(index);
}
/**
@@ -524,7 +524,7 @@
* @since 1.4
*/
public synchronized ItemListener[] getItemListeners() {
- return (ItemListener[])(getListeners(ItemListener.class));
+ return getListeners(ItemListener.class);
}
/**
--- a/jdk/src/share/classes/java/awt/Component.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Component.java Tue Jan 29 20:19:48 2013 -0800
@@ -7287,6 +7287,7 @@
}
final Set<AWTKeyStroke> getFocusTraversalKeys_NoIDCheck(int id) {
// Okay to return Set directly because it is an unmodifiable view
+ @SuppressWarnings("unchecked")
Set<AWTKeyStroke> keystrokes = (focusTraversalKeys != null)
? focusTraversalKeys[id]
: null;
--- a/jdk/src/share/classes/java/awt/Container.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Container.java Tue Jan 29 20:19:48 2013 -0800
@@ -161,7 +161,7 @@
private boolean focusTraversalPolicyProvider;
// keeps track of the threads that are printing this component
- private transient Set printingThreads;
+ private transient Set<Thread> printingThreads;
// True if there is at least one thread that's printing this component
private transient boolean printing = false;
@@ -275,7 +275,7 @@
*/
public Container() {
}
-
+ @SuppressWarnings({"unchecked","rawtypes"})
void initializeFocusTraversalKeys() {
focusTraversalKeys = new Set[4];
}
@@ -2006,7 +2006,7 @@
try {
synchronized (getObjectLock()) {
if (printingThreads == null) {
- printingThreads = new HashSet();
+ printingThreads = new HashSet<>();
}
printingThreads.add(t);
printing = true;
@@ -2148,7 +2148,7 @@
* @since 1.4
*/
public synchronized ContainerListener[] getContainerListeners() {
- return (ContainerListener[]) (getListeners(ContainerListener.class));
+ return getListeners(ContainerListener.class);
}
/**
@@ -2599,9 +2599,9 @@
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
- PointerInfo pi = (PointerInfo)java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ PointerInfo pi = java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction<PointerInfo>() {
+ public PointerInfo run() {
return MouseInfo.getPointerInfo();
}
}
@@ -2682,7 +2682,7 @@
y - comp.y,
ignoreEnabled);
} else {
- comp = comp.locate(x - comp.x, y - comp.y);
+ comp = comp.getComponentAt(x - comp.x, y - comp.y);
}
if (comp != null && comp.visible &&
(ignoreEnabled || comp.enabled))
@@ -2700,7 +2700,7 @@
y - comp.y,
ignoreEnabled);
} else {
- comp = comp.locate(x - comp.x, y - comp.y);
+ comp = comp.getComponentAt(x - comp.x, y - comp.y);
}
if (comp != null && comp.visible &&
(ignoreEnabled || comp.enabled))
@@ -4637,7 +4637,7 @@
private void startListeningForOtherDrags() {
//System.out.println("Adding AWTEventListener");
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
nativeContainer.getToolkit().addAWTEventListener(
LightweightDispatcher.this,
@@ -4652,7 +4652,7 @@
private void stopListeningForOtherDrags() {
//System.out.println("Removing AWTEventListener");
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
nativeContainer.getToolkit().removeAWTEventListener(LightweightDispatcher.this);
return null;
--- a/jdk/src/share/classes/java/awt/Dialog.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Dialog.java Tue Jan 29 20:19:48 2013 -0800
@@ -1047,9 +1047,9 @@
// if this dialog is toolkit-modal, the filter should be added
// to all EDTs (for all AppContexts)
if (modalityType == ModalityType.TOOLKIT_MODAL) {
- Iterator it = AppContext.getAppContexts().iterator();
+ Iterator<AppContext> it = AppContext.getAppContexts().iterator();
while (it.hasNext()) {
- AppContext appContext = (AppContext)it.next();
+ AppContext appContext = it.next();
if (appContext == showAppContext) {
continue;
}
@@ -1084,9 +1084,9 @@
// if this dialog is toolkit-modal, its filter must be removed
// from all EDTs (for all AppContexts)
if (modalityType == ModalityType.TOOLKIT_MODAL) {
- Iterator it = AppContext.getAppContexts().iterator();
+ Iterator<AppContext> it = AppContext.getAppContexts().iterator();
while (it.hasNext()) {
- AppContext appContext = (AppContext)it.next();
+ AppContext appContext = it.next();
if (appContext == showAppContext) {
continue;
}
@@ -1396,7 +1396,7 @@
if (d.shouldBlock(this)) {
Window w = d;
while ((w != null) && (w != this)) {
- w = (Window)(w.getOwner_NoClientCode());
+ w = w.getOwner_NoClientCode();
}
if ((w == this) || !shouldBlock(d) || (modalityType.compareTo(d.getModalityType()) < 0)) {
blockers.add(d);
@@ -1611,7 +1611,7 @@
setModal(modal);
}
- blockedWindows = new IdentityArrayList();
+ blockedWindows = new IdentityArrayList<>();
}
/*
--- a/jdk/src/share/classes/java/awt/Frame.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Frame.java Tue Jan 29 20:19:48 2013 -0800
@@ -353,7 +353,7 @@
* @serial
* @see java.awt.Window#ownedWindowList
*/
- Vector ownedWindows;
+ Vector<Window> ownedWindows;
private static final String base = "frame";
private static int nameCounter = 0;
@@ -1242,7 +1242,7 @@
//
if (ownedWindows != null) {
for (int i = 0; i < ownedWindows.size(); i++) {
- connectOwnedWindow((Window) ownedWindows.elementAt(i));
+ connectOwnedWindow(ownedWindows.elementAt(i));
}
ownedWindows = null;
}
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Tue Jan 29 20:19:48 2013 -0800
@@ -416,7 +416,7 @@
}
}
- static Set initFocusTraversalKeysSet(String value, Set targetSet) {
+ static Set<AWTKeyStroke> initFocusTraversalKeysSet(String value, Set<AWTKeyStroke> targetSet) {
StringTokenizer tokens = new StringTokenizer(value, ",");
while (tokens.hasMoreTokens()) {
targetSet.add(AWTKeyStroke.getAWTKeyStroke(tokens.nextToken()));
--- a/jdk/src/share/classes/java/awt/Scrollbar.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Scrollbar.java Tue Jan 29 20:19:48 2013 -0800
@@ -1012,7 +1012,7 @@
* @since 1.4
*/
public synchronized AdjustmentListener[] getAdjustmentListeners() {
- return (AdjustmentListener[])(getListeners(AdjustmentListener.class));
+ return getListeners(AdjustmentListener.class);
}
/**
--- a/jdk/src/share/classes/java/awt/TextArea.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/TextArea.java Tue Jan 29 20:19:48 2013 -0800
@@ -123,7 +123,7 @@
* Cache the Sets of forward and backward traversal keys so we need not
* look them up each time.
*/
- private static Set forwardTraversalKeys, backwardTraversalKeys;
+ private static Set<AWTKeyStroke> forwardTraversalKeys, backwardTraversalKeys;
/*
* JDK 1.1 serialVersionUID
@@ -143,10 +143,10 @@
}
forwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet(
"ctrl TAB",
- new HashSet());
+ new HashSet<AWTKeyStroke>());
backwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet(
"ctrl shift TAB",
- new HashSet());
+ new HashSet<AWTKeyStroke>());
}
/**
--- a/jdk/src/share/classes/java/awt/TextComponent.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/TextComponent.java Tue Jan 29 20:19:48 2013 -0800
@@ -606,7 +606,7 @@
* @since 1.4
*/
public synchronized TextListener[] getTextListeners() {
- return (TextListener[])(getListeners(TextListener.class));
+ return getListeners(TextListener.class);
}
/**
--- a/jdk/src/share/classes/java/awt/TextField.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/TextField.java Tue Jan 29 20:19:48 2013 -0800
@@ -507,7 +507,7 @@
* @since 1.4
*/
public synchronized ActionListener[] getActionListeners() {
- return (ActionListener[])(getListeners(ActionListener.class));
+ return getListeners(ActionListener.class);
}
/**
--- a/jdk/src/share/classes/java/awt/Toolkit.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Toolkit.java Tue Jan 29 20:19:48 2013 -0800
@@ -863,7 +863,7 @@
new java.security.PrivilegedAction<Void>() {
public Void run() {
String nm = null;
- Class cls = null;
+ Class<?> cls = null;
try {
nm = System.getProperty("awt.toolkit");
try {
--- a/jdk/src/share/classes/java/awt/Window.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Window.java Tue Jan 29 20:19:48 2013 -0800
@@ -441,7 +441,7 @@
transient Object anchor = new Object();
static class WindowDisposerRecord implements sun.java2d.DisposerRecord {
final WeakReference<Window> owner;
- final WeakReference weakThis;
+ final WeakReference<Window> weakThis;
final WeakReference<AppContext> context;
WindowDisposerRecord(AppContext context, Window victim) {
owner = new WeakReference<Window>(victim.getOwner());
@@ -1542,6 +1542,7 @@
private static Window[] getWindows(AppContext appContext) {
synchronized (Window.class) {
Window realCopy[];
+ @SuppressWarnings("unchecked")
Vector<WeakReference<Window>> windowList =
(Vector<WeakReference<Window>>)appContext.get(Window.class);
if (windowList != null) {
@@ -1866,7 +1867,7 @@
* @since 1.4
*/
public synchronized WindowListener[] getWindowListeners() {
- return (WindowListener[])(getListeners(WindowListener.class));
+ return getListeners(WindowListener.class);
}
/**
@@ -1882,7 +1883,7 @@
* @since 1.4
*/
public synchronized WindowFocusListener[] getWindowFocusListeners() {
- return (WindowFocusListener[])(getListeners(WindowFocusListener.class));
+ return getListeners(WindowFocusListener.class);
}
/**
@@ -1898,7 +1899,7 @@
* @since 1.4
*/
public synchronized WindowStateListener[] getWindowStateListeners() {
- return (WindowStateListener[])(getListeners(WindowStateListener.class));
+ return getListeners(WindowStateListener.class);
}
@@ -2014,7 +2015,6 @@
break;
case WindowEvent.WINDOW_STATE_CHANGED:
processWindowStateEvent((WindowEvent)e);
- default:
break;
}
return;
@@ -2382,12 +2382,14 @@
* KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS
* @since 1.4
*/
+ @SuppressWarnings("unchecked")
public Set<AWTKeyStroke> getFocusTraversalKeys(int id) {
if (id < 0 || id >= KeyboardFocusManager.TRAVERSAL_KEY_LENGTH) {
throw new IllegalArgumentException("invalid focus traversal key identifier");
}
// Okay to return Set directly because it is an unmodifiable view
+ @SuppressWarnings("rawtypes")
Set keystrokes = (focusTraversalKeys != null)
? focusTraversalKeys[id]
: null;
@@ -2765,7 +2767,7 @@
/*
* Support for tracking all windows owned by this window
*/
- void addOwnedWindow(WeakReference weakWindow) {
+ void addOwnedWindow(WeakReference<Window> weakWindow) {
if (weakWindow != null) {
synchronized(ownedWindowList) {
// this if statement should really be an assert, but we don't
@@ -2777,7 +2779,7 @@
}
}
- void removeOwnedWindow(WeakReference weakWindow) {
+ void removeOwnedWindow(WeakReference<Window> weakWindow) {
if (weakWindow != null) {
// synchronized block not required since removeElement is
// already synchronized
@@ -2792,6 +2794,7 @@
private void addToWindowList() {
synchronized (Window.class) {
+ @SuppressWarnings("unchecked")
Vector<WeakReference<Window>> windowList = (Vector<WeakReference<Window>>)appContext.get(Window.class);
if (windowList == null) {
windowList = new Vector<WeakReference<Window>>();
@@ -2801,8 +2804,9 @@
}
}
- private static void removeFromWindowList(AppContext context, WeakReference weakThis) {
+ private static void removeFromWindowList(AppContext context, WeakReference<Window> weakThis) {
synchronized (Window.class) {
+ @SuppressWarnings("unchecked")
Vector<WeakReference<Window>> windowList = (Vector<WeakReference<Window>>)context.get(Window.class);
if (windowList != null) {
windowList.remove(weakThis);
@@ -2945,7 +2949,7 @@
// Deserialized Windows are not yet visible.
visible = false;
- weakThis = new WeakReference(this);
+ weakThis = new WeakReference<>(this);
anchor = new Object();
sun.java2d.Disposer.addRecord(anchor, new WindowDisposerRecord(appContext, this));
@@ -2956,7 +2960,7 @@
private void deserializeResources(ObjectInputStream s)
throws ClassNotFoundException, IOException, HeadlessException {
- ownedWindowList = new Vector();
+ ownedWindowList = new Vector<>();
if (windowSerializedDataVersion < 2) {
// Translate old-style focus tracking to new model. For 1.4 and
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Tue Jan 29 20:19:48 2013 -0800
@@ -1153,7 +1153,9 @@
"Menu.menuPopupOffsetY", new Integer(0),
"Menu.submenuPopupOffsetX", new Integer(0),
"Menu.submenuPopupOffsetY", new Integer(0),
- "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK},
+ "Menu.shortcutKeys", new int[]{
+ SwingUtilities2.getSystemMnemonicKeyMask()
+ },
"Menu.crossMenuMnemonic", Boolean.TRUE,
// Menu.cancelMode affects the cancel menu action behaviour;
// currently supports:
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Tue Jan 29 20:19:48 2013 -0800
@@ -1879,6 +1879,20 @@
visRect.x -= i.left;
visRect.y -= i.top;
}
+ // we should consider a non-visible area above
+ Component component = SwingUtilities.getUnwrappedParent(tree);
+ if (component instanceof JViewport) {
+ component = component.getParent();
+ if (component instanceof JScrollPane) {
+ JScrollPane pane = (JScrollPane) component;
+ JScrollBar bar = pane.getHorizontalScrollBar();
+ if ((bar != null) && bar.isVisible()) {
+ int height = bar.getHeight();
+ visRect.y -= height;
+ visRect.height += height;
+ }
+ }
+ }
preferredSize.width = treeState.getPreferredWidth(visRect);
}
else {
@@ -4504,7 +4518,7 @@
}
}
- private void home(JTree tree, BasicTreeUI ui, int direction,
+ private void home(JTree tree, final BasicTreeUI ui, int direction,
boolean addToSelection, boolean changeSelection) {
// disable moving of lead unless in discontiguous mode
@@ -4514,7 +4528,7 @@
changeSelection = true;
}
- int rowCount = ui.getRowCount(tree);
+ final int rowCount = ui.getRowCount(tree);
if (rowCount > 0) {
if(direction == -1) {
@@ -4566,6 +4580,13 @@
ui.setLeadSelectionPath(ui.getPathForRow(tree,
rowCount - 1), true);
}
+ if (ui.isLargeModel()){
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ ui.ensureRowsAreVisible(rowCount - 1, rowCount - 1);
+ }
+ });
+ }
}
}
}
--- a/jdk/src/share/classes/sun/awt/image/SurfaceManager.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/sun/awt/image/SurfaceManager.java Tue Jan 29 20:19:48 2013 -0800
@@ -88,7 +88,7 @@
imgaccessor.setSurfaceManager(img, mgr);
}
- private ConcurrentHashMap cacheMap;
+ private ConcurrentHashMap<Object,Object> cacheMap;
/**
* Return an arbitrary cached object for an arbitrary cache key.
@@ -123,7 +123,7 @@
if (cacheMap == null) {
synchronized (this) {
if (cacheMap == null) {
- cacheMap = new ConcurrentHashMap(2);
+ cacheMap = new ConcurrentHashMap<>(2);
}
}
}
@@ -245,7 +245,7 @@
synchronized void flush(boolean deaccelerate) {
if (cacheMap != null) {
- Iterator i = cacheMap.values().iterator();
+ Iterator<Object> i = cacheMap.values().iterator();
while (i.hasNext()) {
Object o = i.next();
if (o instanceof FlushableCacheData) {
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java Tue Jan 29 20:19:48 2013 -0800
@@ -1879,4 +1879,12 @@
}
return -1;
}
+
+ public static int getSystemMnemonicKeyMask() {
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ if (toolkit instanceof SunToolkit) {
+ return ((SunToolkit) toolkit).getFocusAcceleratorKeyMask();
+ }
+ return InputEvent.ALT_MASK;
+ }
}
--- a/jdk/src/share/classes/sun/swing/WindowsPlacesBar.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/src/share/classes/sun/swing/WindowsPlacesBar.java Tue Jan 29 20:19:48 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -116,9 +116,6 @@
icon = fsv.getSystemIcon(files[i]);
}
buttons[i] = new JToggleButton(folderName, icon);
- if (isXPPlatform) {
- buttons[i].setText("<html><center>"+folderName+"</center></html>");
- }
if (isXPStyle) {
buttons[i].putClientProperty("XPStyle.subAppName", "placesbar");
} else {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.DisplayMode;
+import java.awt.Frame;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Insets;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.Window;
+import java.awt.image.BufferedImage;
+
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8003173 7019055
+ * @summary Full-screen windows should have the proper insets.
+ * @author Sergey Bylokhov
+ */
+public final class FullScreenInsets {
+
+ private static boolean passed = true;
+
+ public static void main(final String[] args) {
+ final GraphicsEnvironment ge = GraphicsEnvironment
+ .getLocalGraphicsEnvironment();
+ final GraphicsDevice[] devices = ge.getScreenDevices();
+
+ final Window wGreen = new Frame();
+ wGreen.setBackground(Color.GREEN);
+ wGreen.setSize(300, 300);
+ wGreen.setVisible(true);
+ sleep();
+ final Insets iGreen = wGreen.getInsets();
+ final Dimension sGreen = wGreen.getSize();
+
+ final Window wRed = new Frame();
+ wRed.setBackground(Color.RED);
+ wRed.setSize(300, 300);
+ wRed.setVisible(true);
+ sleep();
+ final Insets iRed = wGreen.getInsets();
+ final Dimension sRed = wGreen.getSize();
+
+ for (final GraphicsDevice device : devices) {
+ if (!device.isFullScreenSupported()) {
+ continue;
+ }
+ device.setFullScreenWindow(wGreen);
+ sleep();
+ testWindowBounds(device.getDisplayMode(), wGreen);
+ testColor(wGreen, Color.GREEN);
+
+ device.setFullScreenWindow(wRed);
+ sleep();
+ testWindowBounds(device.getDisplayMode(), wRed);
+ testColor(wRed, Color.RED);
+
+ device.setFullScreenWindow(null);
+ sleep();
+ testInsets(wGreen.getInsets(), iGreen);
+ testInsets(wRed.getInsets(), iRed);
+ testSize(wGreen.getSize(), sGreen);
+ testSize(wRed.getSize(), sRed);
+ }
+ wGreen.dispose();
+ wRed.dispose();
+ if (!passed) {
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ private static void testSize(final Dimension actual, final Dimension exp) {
+ if (!exp.equals(actual)) {
+ System.err.println(" Wrong window size:" +
+ " Expected: " + exp + " Actual: " + actual);
+ passed = false;
+ }
+ }
+
+ private static void testInsets(final Insets actual, final Insets exp) {
+ if (!actual.equals(exp)) {
+ System.err.println(" Wrong window insets:" +
+ " Expected: " + exp + " Actual: " + actual);
+ passed = false;
+ }
+ }
+
+ private static void testWindowBounds(final DisplayMode dm, final Window w) {
+ if (w.getWidth() != dm.getWidth() || w.getHeight() != dm.getHeight()) {
+ System.err.println(" Wrong window bounds:" +
+ " Expected: width = " + dm.getWidth()
+ + ", height = " + dm.getHeight() + " Actual: "
+ + w.getSize());
+ passed = false;
+ }
+ }
+
+ private static void testColor(final Window w, final Color color) {
+ final Robot r;
+ try {
+ r = new Robot(w.getGraphicsConfiguration().getDevice());
+ } catch (AWTException e) {
+ e.printStackTrace();
+ passed = false;
+ return;
+ }
+ final BufferedImage bi = r.createScreenCapture(w.getBounds());
+ for (int y = 0; y < bi.getHeight(); y++) {
+ for (int x = 0; x < bi.getWidth(); x++) {
+ if (bi.getRGB(x, y) != color.getRGB()) {
+ System.err.println(
+ "Incorrect pixel at " + x + "x" + y + " : " +
+ Integer.toHexString(bi.getRGB(x, y)) +
+ " ,expected : " + Integer.toHexString(
+ color.getRGB()));
+ passed = false;
+ return;
+ }
+ }
+ }
+ }
+
+ private static void sleep() {
+ ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ignored) {
+ }
+ }
+}
--- a/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java Tue Jan 29 20:19:48 2013 -0800
@@ -36,6 +36,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.lang.reflect.InvocationTargetException;
import test.java.awt.regtesthelpers.Util;
+import sun.awt.OSInfo;
public class SubMenuShowTest extends Applet {
Robot robot;
@@ -86,6 +87,11 @@
frame.setVisible(true);
Util.waitForIdle(robot);
+ boolean isMacOSX = (OSInfo.getOSType() == OSInfo.OSType.MACOSX);
+ if (isMacOSX) {
+ robot.keyPress(KeyEvent.VK_CONTROL);
+ robot.delay(20);
+ }
robot.keyPress(KeyEvent.VK_ALT);
robot.delay(20);
robot.keyPress(KeyEvent.VK_F);
@@ -93,6 +99,10 @@
robot.keyRelease(KeyEvent.VK_F);
robot.delay(20);
robot.keyRelease(KeyEvent.VK_ALT);
+ if (isMacOSX) {
+ robot.keyRelease(KeyEvent.VK_CONTROL);
+ robot.delay(20);
+ }
Util.waitForIdle(robot);
robot.keyPress(KeyEvent.VK_M);
--- a/jdk/test/java/beans/Introspector/TestTypeResolver.java Sat Jan 26 19:22:51 2013 -0800
+++ b/jdk/test/java/beans/Introspector/TestTypeResolver.java Tue Jan 29 20:19:48 2013 -0800
@@ -180,10 +180,22 @@
return null; // not used
}
+ public <T extends Annotation> T[] getAnnotations(Class<T> annotationClass) {
+ return null; // not used
+ }
+
public Annotation[] getAnnotations() {
return null; // not used
}
+ public <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) {
+ return null; // not used
+ }
+
+ public <T extends Annotation> T[] getDeclaredAnnotations(Class<T> annotationClass) {
+ return null; // not used
+ }
+
public Annotation[] getDeclaredAnnotations() {
return null; // not used
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 8006417
+ @summary JComboBox.showPopup(), hidePopup() fails in JRE 1.7 on OS X
+ @author Anton Litvinov
+*/
+
+import java.awt.*;
+
+import javax.swing.*;
+import javax.swing.plaf.metal.*;
+
+import sun.awt.SunToolkit;
+
+public class ShowPopupAfterHidePopupTest {
+ private static JFrame frame = null;
+ private static JComboBox comboBox = null;
+ private static boolean popupIsVisible = false;
+
+ public static void main(String[] args) throws Exception {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ frame = new JFrame("Popup Menu of JComboBox");
+ comboBox = new JComboBox(new String[]{"Item1", "Item2", "Item3"});
+ frame.getContentPane().add(comboBox);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ comboBox.showPopup();
+ comboBox.hidePopup();
+ comboBox.showPopup();
+ }
+ });
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ popupIsVisible = comboBox.isPopupVisible();
+ frame.dispose();
+ }
+ });
+ if (!popupIsVisible) {
+ throw new RuntimeException("Calling hidePopup() affected the next call to showPopup().");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/6817933/Test6817933.java Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6817933
+ * @summary Tests that HTMLEditorKit does not affect JFileChooser
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JToggleButton;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.text.html.HTMLEditorKit;
+import javax.swing.text.html.StyleSheet;
+
+import sun.awt.SunToolkit;
+import sun.swing.WindowsPlacesBar;
+
+public class Test6817933 {
+
+ private static final String STYLE = "BODY {background:red}";
+ private static final Color COLOR = Color.RED;
+ private static JFileChooser chooser;
+
+ public static void main(String[] args) throws Exception {
+ try {
+ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+ }
+ catch (Exception exception) {
+ exception.printStackTrace();
+ return; // ignore test on non-Windows machines
+ }
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ StyleSheet css = new StyleSheet();
+ css.addRule(STYLE);
+
+ HTMLEditorKit kit = new HTMLEditorKit();
+ kit.setStyleSheet(css);
+
+ JFrame frame = new JFrame(STYLE);
+ frame.add(chooser = new JFileChooser());
+ frame.setSize(640, 480);
+ frame.setVisible(true);
+ }
+ });
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ toolkit.realSync(500);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ JToggleButton button = get(JToggleButton.class,
+ get(WindowsPlacesBar.class, chooser));
+
+ int width = button.getWidth();
+ int height = button.getHeight() / 3;
+ Point point = new Point(0, height * 2);
+ SwingUtilities.convertPointToScreen(point, button);
+ width += point.x;
+ height += point.y;
+
+ int count = 0;
+ Robot robot = new Robot();
+ for (int x = point.x; x < width; x++) {
+ for (int y = point.y; y < height; y++) {
+ count += COLOR.equals(robot.getPixelColor(x, y)) ? -2 : 1;
+ }
+ }
+ if (count < 0) {
+ throw new Exception("TEST ERROR: a lot of red pixels");
+ }
+ }
+ catch (Exception exception) {
+ throw new Error(exception);
+ }
+ finally {
+ SwingUtilities.getWindowAncestor(chooser).dispose();
+ }
+ }
+ });
+ }
+
+ private static <T> T get(Class<? extends T> type, Container container) {
+ Component component = container.getComponent(0);
+ if (!type.isAssignableFrom(component.getClass())) {
+ throw new IllegalStateException("expected " + type + "; expected " + component.getClass());
+ }
+ return (T) component;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTree/8003400/Test8003400.java Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003400
+ * @summary Tests that JTree shows the last row
+ * @author Sergey Malenkov
+ * @run main/othervm Test8003400
+ * @run main/othervm Test8003400 reverse
+ * @run main/othervm Test8003400 system
+ * @run main/othervm Test8003400 system reverse
+ */
+
+import sun.awt.SunToolkit;
+
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.tree.DefaultMutableTreeNode;
+
+public class Test8003400 {
+
+ private static final String TITLE = "Test JTree with a large model";
+ private static List<String> OBJECTS = Arrays.asList(TITLE, "x", "y", "z");
+ private static JScrollPane pane;
+
+ public static void main(String[] args) throws Exception {
+ for (String arg : args) {
+ if (arg.equals("reverse")) {
+ Collections.reverse(OBJECTS);
+ }
+ if (arg.equals("system")) {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ }
+ }
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode();
+
+ JTree tree = new JTree(root);
+ tree.setLargeModel(true);
+ tree.setRowHeight(16);
+
+ JFrame frame = new JFrame(TITLE);
+ frame.add(pane = new JScrollPane(tree));
+ frame.setSize(200, 100);
+ frame.setLocationRelativeTo(null);
+ frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ frame.setVisible(true);
+
+ for (String object : OBJECTS) {
+ root.add(new DefaultMutableTreeNode(object));
+ }
+ tree.expandRow(0);
+ }
+ });
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ toolkit.realSync(500);
+ new Robot().keyPress(KeyEvent.VK_END);
+ toolkit.realSync(500);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ JTree tree = (JTree) pane.getViewport().getView();
+ Rectangle inner = tree.getRowBounds(tree.getRowCount() - 1);
+ Rectangle outer = SwingUtilities.convertRectangle(tree, inner, pane);
+ outer.y += tree.getRowHeight() - 1 - pane.getVerticalScrollBar().getHeight();
+ // error reporting only for automatic testing
+ if (null != System.getProperty("test.src", null)) {
+ SwingUtilities.getWindowAncestor(pane).dispose();
+ if (outer.y != 0) {
+ throw new Error("TEST FAILED: " + outer.y);
+ }
+ }
+ }
+ });
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTree/8004298/bug8004298.java Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8004298
+ * @summary NPE in WindowsTreeUI.ensureRowsAreVisible
+ * @author Alexander Scherbatiy
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main bug8004298
+ */
+
+import java.awt.*;
+import java.awt.event.InputEvent;
+import javax.swing.*;
+import javax.swing.tree.*;
+import java.util.concurrent.Callable;
+import sun.awt.SunToolkit;
+import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
+import com.sun.java.swing.plaf.windows.WindowsTreeUI;
+
+public class bug8004298 {
+
+ private static JTree tree;
+
+ public static void main(String[] args) throws Exception {
+ Robot robot = new Robot();
+ robot.setAutoDelay(50);
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ UIManager.setLookAndFeel(new WindowsLookAndFeel());
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ Point point = Util.invokeOnEDT(new Callable<Point>() {
+
+ @Override
+ public Point call() throws Exception {
+ Rectangle rect = tree.getRowBounds(2);
+ Point p = new Point(rect.x + rect.width / 2, rect.y + rect.height / 2);
+ SwingUtilities.convertPointToScreen(p, tree);
+ return p;
+ }
+ });
+
+ robot.mouseMove(point.x, point.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ }
+
+ private static void createAndShowGUI() {
+ JFrame frame = new JFrame();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
+ root.add(new DefaultMutableTreeNode("colors"));
+ DefaultMutableTreeNode sports = new DefaultMutableTreeNode("sports");
+ sports.add(new DefaultMutableTreeNode("basketball"));
+ sports.add(new DefaultMutableTreeNode("football"));
+ root.add(sports);
+
+ tree = new JTree(root);
+ tree.setUI(new NullReturningTreeUI());
+
+ frame.getContentPane().add(tree);
+ frame.pack();
+ frame.setVisible(true);
+
+ }
+
+ private static final class NullReturningTreeUI extends WindowsTreeUI {
+
+ @Override
+ public Rectangle getPathBounds(JTree tree, TreePath path) {
+ // the method can return null and callers have to be ready for
+ // that. Simulate the case by returning null for unknown reason.
+ if (path != null && path.toString().contains("football")) {
+ return null;
+ }
+
+ return super.getPathBounds(tree, path);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/SpringLayout/4726194/bug4726194.java Tue Jan 29 20:19:48 2013 -0800
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4726194 7124209
+ * @summary Tests for 4726194
+ * @author Phil Milne
+ */
+import java.awt.*;
+import java.lang.reflect.InvocationTargetException;
+import java.util.*;
+import java.util.List;
+import javax.swing.*;
+
+public class bug4726194 {
+
+ private static String[] hConstraints = {SpringLayout.WEST, "Width", SpringLayout.EAST, SpringLayout.HORIZONTAL_CENTER};
+ private static String[] vConstraints = {SpringLayout.NORTH, "Height", SpringLayout.SOUTH, SpringLayout.VERTICAL_CENTER, SpringLayout.BASELINE};
+ private static int[] FAIL = new int[3];
+ private static boolean TEST_DUPLICATES = false;
+
+ public static void main(String[] args) {
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ int minLevel = 2;
+ int maxLevel = 2;
+ for (int i = minLevel; i <= maxLevel; i++) {
+ test(i, true);
+ test(i, false);
+ }
+ }
+ });
+ } catch (InterruptedException | InvocationTargetException ex) {
+ ex.printStackTrace();
+ throw new RuntimeException("FAILED: SwingUtilities.invokeAndWait method failed!");
+ }
+ }
+
+ public static void test(int level, boolean horizontal) {
+ List result = new ArrayList();
+ String[] constraints = horizontal ? hConstraints : vConstraints;
+ test(level, constraints, result, Arrays.asList(new Object[level]));
+ JTextField tf = new JTextField("");
+ tf.setFont(new Font("Dialog", Font.PLAIN, 6));
+ System.out.print("\t\t");
+ for (int j = 0; j < constraints.length; j++) {
+ String constraint = constraints[j];
+ System.out.print(constraint + " ".substring(constraint.length()));
+ }
+ System.out.println("");
+ for (int i = 0; i < result.size(); i++) {
+ SpringLayout.Constraints c = new SpringLayout.Constraints(tf);
+ List cc = (List) result.get(i);
+ for (int j = 0; j < cc.size(); j++) {
+ String constraint = (String) cc.get(j);
+ c.setConstraint(constraint, Spring.constant((j + 1) * 10));
+ }
+ System.out.print(" Input:\t\t");
+ for (int j = 0; j < constraints.length; j++) {
+ String constraint = constraints[j];
+ int jj = cc.indexOf(constraint);
+ String val = cc.contains(constraint) ? Integer.toString((jj + 1) * 10) : "?";
+ System.out.print(val + "\t\t");
+ }
+ System.out.println("");
+ System.out.print("Output:\t\t");
+ for (int j = 0; j < constraints.length; j++) {
+ String constraint = constraints[j];
+ Spring spring = c.getConstraint(constraint);
+ String springVal = (spring == null) ? "?" : Integer.toString(spring.getValue());
+ System.out.print(springVal);
+ System.out.print("\t\t");
+ }
+ for (int j = 0; j < cc.size(); j++) {
+ String constraint = (String) cc.get(j);
+ Spring con = c.getConstraint(constraint);
+ if (con == null || con.getValue() != (j + 1) * 10) {
+ throw new RuntimeException("Values are wrong!!! ");
+ }
+ }
+ if (horizontal) {
+ int[] a1 = getValues(c, new String[]{SpringLayout.WEST, SpringLayout.WIDTH, SpringLayout.EAST});
+ if (a1[0] + a1[1] != a1[2]) {
+ throw new RuntimeException("WEST + WIDTH != EAST!!! ");
+ }
+ int[] a2 = getValues(c, new String[]{SpringLayout.WEST, SpringLayout.WIDTH, SpringLayout.HORIZONTAL_CENTER});
+ if (a2[0] + a2[1] / 2 != a2[2]) {
+ throw new RuntimeException("WEST + WIDTH/2 != HORIZONTAL_CENTER!!! ");
+ }
+ } else {
+ int[] a3 = getValues(c, new String[]{SpringLayout.NORTH, SpringLayout.HEIGHT, SpringLayout.SOUTH});
+ if (a3[0] + a3[1] != a3[2]) {
+ throw new RuntimeException("NORTH + HEIGHT != SOUTH!!! ");
+ }
+ int[] a4 = getValues(c, new String[]{SpringLayout.NORTH, SpringLayout.HEIGHT, SpringLayout.VERTICAL_CENTER});
+ int vcDiff = Math.abs(a4[0] + a4[1] / 2 - a4[2]);
+ if (vcDiff > 1) {
+ throw new RuntimeException("NORTH + HEIGHT/2 != VERTICAL_CENTER!!! ");
+ }
+ int[] a5 = getValues(c, new String[]{SpringLayout.NORTH, SpringLayout.BASELINE, SpringLayout.SOUTH});
+ if (a5[0] > a5[1] != a5[1] > a5[2]) {
+ throw new RuntimeException("BASELINE is not in the range: [NORTH, SOUTH]!!!");
+ }
+ }
+ System.out.println("");
+ }
+ System.out.println("");
+ }
+
+ private static int[] getValues(SpringLayout.Constraints con, String[] cNames) {
+ int[] result = new int[cNames.length];
+ for (int i = 0; i < cNames.length; i++) {
+ String name = cNames[i];
+ Spring s = con.getConstraint(name);
+ if (s == null) {
+ System.out.print("Warning: " + name + " is undefined. ");
+ return FAIL;
+ }
+ result[i] = s.getValue();
+ }
+ return result;
+ }
+
+ public static void test(int level, String[] constraints, List result, List soFar) {
+ if (level == 0) {
+ result.add(soFar);
+ return;
+ }
+ for (int i = 0; i < constraints.length; i++) {
+ if (soFar.contains(constraints[i]) && !TEST_DUPLICATES) {
+ continue;
+ }
+ List child = new ArrayList(soFar);
+ child.set(level - 1, constraints[i]);
+ test(level - 1, constraints, result, child);
+ }
+ }
+}