1.1 --- a/make/common/Sanity.gmk Thu May 21 18:41:50 2009 +0100
1.2 +++ b/make/common/Sanity.gmk Tue Jun 09 23:47:38 2009 -0700
1.3 @@ -92,6 +92,7 @@
1.4 sane-ld_run_path \
1.5 sane-alt_bootdir \
1.6 sane-bootdir \
1.7 + sane-local-bootdir \
1.8 sane-alsa-headers \
1.9 sane-jibx
1.10
2.1 --- a/make/common/shared/Defs-windows.gmk Thu May 21 18:41:50 2009 +0100
2.2 +++ b/make/common/shared/Defs-windows.gmk Tue Jun 09 23:47:38 2009 -0700
2.3 @@ -431,9 +431,11 @@
2.4
2.5 # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
2.6 # _BOOTDIR2: Second choice
2.7 +# The _BOOTDIR3 is defind optionally.
2.8 ifndef ALT_BOOTDIR
2.9 _BOOTDIR1 =$(_system_drive)/jdk$(PREVIOUS_JDK_VERSION)
2.10 _BOOTDIR2 =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION)
2.11 + _BOOTDIR3 =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
2.12 endif
2.13
2.14 # 32 bit always needs 2 runtimes, 64 bit usually does too
3.1 --- a/make/common/shared/Defs.gmk Thu May 21 18:41:50 2009 +0100
3.2 +++ b/make/common/shared/Defs.gmk Tue Jun 09 23:47:38 2009 -0700
3.3 @@ -94,6 +94,21 @@
3.4 fi)
3.5 endef
3.6
3.7 +# Select a directory if it exists, or the alternate 2, or the alternate 3, or the alternate 4
3.8 +define DirExists4
3.9 +$(shell \
3.10 + if [ -d "$1" ]; then \
3.11 + echo "$1"; \
3.12 + elif [ -d "$2" ]; then \
3.13 + echo "$2"; \
3.14 + elif [ -d "$3" ]; then \
3.15 + echo "$3"; \
3.16 + else \
3.17 + echo "$4"; \
3.18 + fi)
3.19 +endef
3.20 +
3.21 +
3.22 # Select a writable directory if it exists and is writable, or the alternate
3.23 define WriteDirExists
3.24 $(shell \
3.25 @@ -356,10 +371,15 @@
3.26
3.27 # BOOTDIR: Bootstrap JDK, previous released JDK.
3.28 # _BOOTDIR1 and _BOOTDIR2 picked by platform
3.29 +# Platform may optionally define _BOOTDIR3 as well.
3.30 ifdef ALT_BOOTDIR
3.31 BOOTDIR =$(ALT_BOOTDIR)
3.32 else
3.33 - BOOTDIR :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR)
3.34 + ifdef _BOOTDIR3
3.35 + BOOTDIR :=$(call DirExists4,$(_BOOTDIR1),$(_BOOTDIR2),$(_BOOTDIR3),/NO_BOOTDIR)
3.36 + else
3.37 + BOOTDIR :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR)
3.38 + endif
3.39 endif
3.40 export BOOTDIR
3.41 BOOTDIR:=$(call AltCheckSpaces,BOOTDIR)
4.1 --- a/make/common/shared/Sanity.gmk Thu May 21 18:41:50 2009 +0100
4.2 +++ b/make/common/shared/Sanity.gmk Tue Jun 09 23:47:38 2009 -0700
4.3 @@ -194,7 +194,8 @@
4.4 sane-outputdir \
4.5 sane-alt_bootdir \
4.6 sane-bootdir \
4.7 - sane-cups \
4.8 + sane-local-bootdir \
4.9 + sane-cups \
4.10 sane-devtools_path \
4.11 sane-compiler_path \
4.12 sane-unixcommand_path \
4.13 @@ -767,6 +768,23 @@
4.14 fi
4.15
4.16 ######################################################
4.17 +# BOOTDIR is recommended to reside on a local drive
4.18 +######################################################
4.19 +sane-local-bootdir:
4.20 +ifeq ($(PLATFORM), windows)
4.21 + @if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -ci '^J:'` -ne 0 ]; then \
4.22 + $(ECHO) "WARNING: Your BOOTDIR is located on the J: drive. Often the J:\n" \
4.23 + " drive is mapped over a network. Using a mapped drive for\n" \
4.24 + " the BOOTDIR may significantly slow down the build process.\n" \
4.25 + " You may want to consider using the ALT_BOOTDIR variable\n" \
4.26 + " to point the build to another location for the BOOTDIR instead. \n" \
4.27 + " Your current BOOTDIR is:\n" \
4.28 + " $(BOOTDIR) \n" \
4.29 + "" >> $(WARNING_FILE) ; \
4.30 + fi
4.31 +endif
4.32 +
4.33 +######################################################
4.34 # CACERTS_FILE must be absoulte path and readable
4.35 ######################################################
4.36 sane-cacerts:
5.1 --- a/make/sun/javazic/tzdata/VERSION Thu May 21 18:41:50 2009 +0100
5.2 +++ b/make/sun/javazic/tzdata/VERSION Tue Jun 09 23:47:38 2009 -0700
5.3 @@ -21,4 +21,4 @@
5.4 # CA 95054 USA or visit www.sun.com if you need additional information or
5.5 # have any questions.
5.6 #
5.7 -tzdata2009a
5.8 +tzdata2009g
6.1 --- a/make/sun/javazic/tzdata/africa Thu May 21 18:41:50 2009 +0100
6.2 +++ b/make/sun/javazic/tzdata/africa Tue Jun 09 23:47:38 2009 -0700
6.3 @@ -258,7 +258,46 @@
6.4 # unless discontinued, next DST may end Thursday 28 August 2008.
6.5 # From Paul Eggert (2007-08-17):
6.6 # For lack of better info, assume the new rule is last Thursday in August.
6.7 -Rule Egypt 2008 max - Aug lastThu 23:00s 0 -
6.8 +
6.9 +# From Petr Machata (2009-04-06):
6.10 +# The following appeared in Red Hat bugzilla[1] (edited):
6.11 +#
6.12 +# > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
6.13 +# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 21:59:59 2009 UTC =3D Thu =
6.14 +# Apr 23
6.15 +# > 23:59:59 2009 EET isdst=3D0 gmtoff=3D7200
6.16 +# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 22:00:00 2009 UTC =3D Fri =
6.17 +# Apr 24
6.18 +# > 01:00:00 2009 EEST isdst=3D1 gmtoff=3D10800
6.19 +# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 20:59:59 2009 UTC =3D Thu =
6.20 +# Aug 27
6.21 +# > 23:59:59 2009 EEST isdst=3D1 gmtoff=3D10800
6.22 +# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 21:00:00 2009 UTC =3D Thu =
6.23 +# Aug 27
6.24 +# > 23:00:00 2009 EET isdst=3D0 gmtoff=3D7200
6.25 +#
6.26 +# > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
6.27 +# :59)
6.28 +# > http://support.microsoft.com/kb/958729/
6.29 +#
6.30 +# timeanddate[2] and another site I've found[3] also support that.
6.31 +#
6.32 +# [1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=3D492263">
6.33 +# https://bugzilla.redhat.com/show_bug.cgi?id=3D492263
6.34 +# </a>
6.35 +# [2] <a href="http://www.timeanddate.com/worldclock/clockchange.html?n=3D53">
6.36 +# http://www.timeanddate.com/worldclock/clockchange.html?n=3D53
6.37 +# </a>
6.38 +# [3] <a href="http://wwp.greenwichmeantime.com/time-zone/africa/egypt/">
6.39 +# http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
6.40 +# </a>
6.41 +
6.42 +# From Arthur David Olson (2009-04-20):
6.43 +# In 2009 (and for the next several years), Ramadan ends before the fourth
6.44 +# Thursday in September; Egypt is expected to revert to the last Thursday
6.45 +# in September.
6.46 +Rule Egypt 2008 only - Aug lastThu 23:00s 0 -
6.47 +Rule Egypt 2009 max - Sep lastThu 23:00s 0 -
6.48
6.49 # Zone NAME GMTOFF RULES FORMAT [UNTIL]
6.50 Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
6.51 @@ -586,6 +625,40 @@
6.52 # <a href="http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html">
6.53 # http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
6.54 # </a>
6.55 +
6.56 +# From Steffen Thorsen (2009-03-17):
6.57 +# Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according
6.58 +# to many sources, such as
6.59 +# <a href="http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html">
6.60 +# http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html
6.61 +# </a>
6.62 +# <a href="http://www.medi1sat.ma/fr/depeche.aspx?idp=2312">
6.63 +# http://www.medi1sat.ma/fr/depeche.aspx?idp=2312
6.64 +# </a>
6.65 +# (French)
6.66 +#
6.67 +# Our summary:
6.68 +# <a href="http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html">
6.69 +# http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
6.70 +# </a>
6.71 +
6.72 +# From Alexander Krivenyshev (2009-03-17):
6.73 +# Here is a link to official document from Royaume du Maroc Premier Ministre,
6.74 +# Ministere de la Modernisation des Secteurs Publics
6.75 +#
6.76 +# Under Article 1 of Royal Decree No. 455-67 of Act 23 safar 1387 (2 june 1967)
6.77 +# concerning the amendment of the legal time, the Ministry of Modernization of
6.78 +# Public Sectors announced that the official time in the Kingdom will be
6.79 +# advanced 60 minutes from Sunday 31 May 2009 at midnight.
6.80 +#
6.81 +# <a href="http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf">
6.82 +# http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf
6.83 +# </a>
6.84 +#
6.85 +# <a href="http://www.worldtimezone.com/dst_news/dst_news_morocco03.html">
6.86 +# http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
6.87 +# </a>
6.88 +
6.89 # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
6.90
6.91 Rule Morocco 1939 only - Sep 12 0:00 1:00 S
6.92 @@ -605,6 +678,8 @@
6.93 Rule Morocco 1978 only - Aug 4 0:00 0 -
6.94 Rule Morocco 2008 only - Jun 1 0:00 1:00 S
6.95 Rule Morocco 2008 only - Sep 1 0:00 0 -
6.96 +Rule Morocco 2009 only - Jun 1 0:00 1:00 S
6.97 +Rule Morocco 2009 only - Aug 21 0:00 0 -
6.98 # Zone NAME GMTOFF RULES FORMAT [UNTIL]
6.99 Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
6.100 0:00 Morocco WE%sT 1984 Mar 16
6.101 @@ -809,6 +884,43 @@
6.102 # Ending : the last Sunday of October at 03:00 ...
6.103 # http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=1188&Itemid=50
6.104
6.105 +# From Steffen Thorsen (2009-03-16):
6.106 +# According to several news sources, Tunisia will not observe DST this year.
6.107 +# (Arabic)
6.108 +# <a href="http://www.elbashayer.com/?page=viewn&nid=42546">
6.109 +# http://www.elbashayer.com/?page=viewn&nid=42546
6.110 +# </a>
6.111 +# <a href="http://www.babnet.net/kiwidetail-15295.asp">
6.112 +# http://www.babnet.net/kiwidetail-15295.asp
6.113 +# </a>
6.114 +#
6.115 +# We have also confirmed this with the US embassy in Tunisia.
6.116 +# We have a wrap-up about this on the following page:
6.117 +# <a href="http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html">
6.118 +# http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
6.119 +# </a>
6.120 +
6.121 +# From Alexander Krivenyshev (2009-03-17):
6.122 +# Here is a link to Tunis Afrique Presse News Agency
6.123 +#
6.124 +# Standard time to be kept the whole year long (tap.info.tn):
6.125 +#
6.126 +# (in English)
6.127 +# <a href="http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157">
6.128 +# http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157
6.129 +# </a>
6.130 +#
6.131 +# (in Arabic)
6.132 +# <a href="http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1">
6.133 +# http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1
6.134 +# </a>
6.135 +
6.136 +# From Arthur David Olson (2009--3-18):
6.137 +# The Tunis Afrique Presse News Agency notice contains this: "This measure is due to the fact
6.138 +# that the fasting month of ramadan coincides with the period concerned by summer time.
6.139 +# Therefore, the standard time will be kept unchanged the whole year long."
6.140 +# So foregoing DST seems to be an exception (albeit one that may be repeated in the future).
6.141 +
6.142 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
6.143 Rule Tunisia 1939 only - Apr 15 23:00s 1:00 S
6.144 Rule Tunisia 1939 only - Nov 18 23:00s 0 -
6.145 @@ -833,8 +945,10 @@
6.146 Rule Tunisia 1990 only - May 1 0:00s 1:00 S
6.147 Rule Tunisia 2005 only - May 1 0:00s 1:00 S
6.148 Rule Tunisia 2005 only - Sep 30 1:00s 0 -
6.149 -Rule Tunisia 2006 max - Mar lastSun 2:00s 1:00 S
6.150 -Rule Tunisia 2006 max - Oct lastSun 2:00s 0 -
6.151 +Rule Tunisia 2006 2008 - Mar lastSun 2:00s 1:00 S
6.152 +Rule Tunisia 2006 2008 - Oct lastSun 2:00s 0 -
6.153 +Rule Tunisia 2010 max - Mar lastSun 2:00s 1:00 S
6.154 +Rule Tunisia 2010 max - Oct lastSun 2:00s 0 -
6.155 # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
6.156 # more precise 0:09:21.
6.157 # Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11.
7.1 --- a/make/sun/javazic/tzdata/asia Thu May 21 18:41:50 2009 +0100
7.2 +++ b/make/sun/javazic/tzdata/asia Tue Jun 09 23:47:38 2009 -0700
7.3 @@ -1071,6 +1071,40 @@
7.4 # http://www.petranews.gov.jo/nepras/2006/Sep/05/4000.htm
7.5 # "Jordan will switch to winter time on Friday, October 27".
7.6 #
7.7 +
7.8 +# From Phil Pizzey (2009-04-02):
7.9 +# ...I think I may have spotted an error in the timezone data for
7.10 +# Jordan.
7.11 +# The current (2009d) asia file shows Jordan going to daylight
7.12 +# saving
7.13 +# time on the last Thursday in March.
7.14 +#
7.15 +# Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
7.16 +#
7.17 +# However timeanddate.com, which I usually find reliable, shows Jordan
7.18 +# going to daylight saving time on the last Friday in March since 2002.
7.19 +# Please see
7.20 +# <a href="http://www.timeanddate.com/worldclock/timezone.html?n=11">
7.21 +# http://www.timeanddate.com/worldclock/timezone.html?n=11
7.22 +# </a>
7.23 +
7.24 +# From Steffen Thorsen (2009-04-02):
7.25 +# This single one might be good enough, (2009-03-24, Arabic):
7.26 +# <a href="http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279">
7.27 +# http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279
7.28 +# </a>
7.29 +#
7.30 +# Google's translation:
7.31 +#
7.32 +# > The Council of Ministers decided in 2002 to adopt the principle of timely
7.33 +# > submission of the summer at 60 minutes as of midnight on the last Thursday
7.34 +# > of the month of March of each year.
7.35 +#
7.36 +# So - this means the midnight between Thursday and Friday since 2002.
7.37 +
7.38 +# From Arthur David Olson (2009-04-06):
7.39 +# We still have Jordan switching to DST on Thursdays in 2000 and 2001.
7.40 +
7.41 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
7.42 Rule Jordan 1973 only - Jun 6 0:00 1:00 S
7.43 Rule Jordan 1973 1975 - Oct 1 0:00 0 -
7.44 @@ -1093,8 +1127,9 @@
7.45 Rule Jordan 1994 only - Sep Fri>=15 0:00 0 -
7.46 Rule Jordan 1995 1998 - Sep Fri>=15 0:00s 0 -
7.47 Rule Jordan 1999 only - Jul 1 0:00s 1:00 S
7.48 -Rule Jordan 1999 2002 - Sep lastThu 0:00s 0 -
7.49 -Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
7.50 +Rule Jordan 1999 2002 - Sep lastFri 0:00s 0 -
7.51 +Rule Jordan 2000 2001 - Mar lastThu 0:00s 1:00 S
7.52 +Rule Jordan 2002 max - Mar lastFri 0:00s 1:00 S
7.53 Rule Jordan 2003 only - Oct 24 0:00s 0 -
7.54 Rule Jordan 2004 only - Oct 15 0:00s 0 -
7.55 Rule Jordan 2005 only - Sep lastFri 0:00s 0 -
7.56 @@ -1576,11 +1611,46 @@
7.57 # http://dailymailnews.com/200808/28/news/dmbrn03.html
7.58 # </a>
7.59
7.60 +# From Alexander Krivenyshev (2009-04-08):
7.61 +# Based on previous media reports that "... proposed plan to
7.62 +# advance clocks by one hour from May 1 will cause disturbance
7.63 +# to the working schedules rather than bringing discipline in
7.64 +# official working."
7.65 +# <a href="http://www.thenews.com.pk/daily_detail.asp?id=171280">
7.66 +# http://www.thenews.com.pk/daily_detail.asp?id=171280
7.67 +# </a>
7.68 +#
7.69 +# recent news that instead of May 2009 - Pakistan plan to
7.70 +# introduce DST from April 15, 2009
7.71 +#
7.72 +# FYI: Associated Press Of Pakistan
7.73 +# April 08, 2009
7.74 +# Cabinet okays proposal to advance clocks by one hour from April 15
7.75 +# <a href="http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1">
7.76 +# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1
7.77 +# </a>
7.78 +#
7.79 +# or
7.80 +#
7.81 +# <a href="http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html">
7.82 +# http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html
7.83 +# </a>
7.84 +#
7.85 +# ....
7.86 +# The Federal Cabinet on Wednesday approved the proposal to
7.87 +# advance clocks in the country by one hour from April 15 to
7.88 +# conserve energy"
7.89 +
7.90 +# From Arthur David Olson (2009-04-10):
7.91 +# Assume for now that Pakistan will end DST in 2009 as it did in 2008.
7.92 +
7.93 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
7.94 Rule Pakistan 2002 only - Apr Sun>=2 0:01 1:00 S
7.95 Rule Pakistan 2002 only - Oct Sun>=2 0:01 0 -
7.96 Rule Pakistan 2008 only - Jun 1 0:00 1:00 S
7.97 Rule Pakistan 2008 only - Nov 1 0:00 0 -
7.98 +Rule Pakistan 2009 only - Apr 15 0:00 1:00 S
7.99 +Rule Pakistan 2009 only - Nov 1 0:00 0 -
7.100 # Zone NAME GMTOFF RULES FORMAT [UNTIL]
7.101 Zone Asia/Karachi 4:28:12 - LMT 1907
7.102 5:30 - IST 1942 Sep
7.103 @@ -1717,6 +1787,22 @@
7.104 # http://www.worldtimezone.com/dst_news/dst_news_gazastrip01.html
7.105 # </a>
7.106
7.107 +# From Alexander Krivenyshev (2009-03-26):
7.108 +# According to the Palestine News Network (arabic.pnn.ps), Palestinian
7.109 +# government decided to start Daylight Time on Thursday night March
7.110 +# 26 and continue until the night of 27 September 2009.
7.111 +#
7.112 +# (in Arabic)
7.113 +# <a href="http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850">
7.114 +# http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850
7.115 +# </a>
7.116 +#
7.117 +# or
7.118 +# (English translation)
7.119 +# <a href="http://www.worldtimezone.com/dst_news/dst_news_westbank01.html">
7.120 +# http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
7.121 +# </a>
7.122 +
7.123 # The rules for Egypt are stolen from the `africa' file.
7.124 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
7.125 Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
7.126 @@ -1730,10 +1816,12 @@
7.127 Rule Palestine 1999 2003 - Oct Fri>=15 0:00 0 -
7.128 Rule Palestine 2004 only - Oct 1 1:00 0 -
7.129 Rule Palestine 2005 only - Oct 4 2:00 0 -
7.130 -Rule Palestine 2006 max - Apr 1 0:00 1:00 S
7.131 +Rule Palestine 2006 2008 - Apr 1 0:00 1:00 S
7.132 Rule Palestine 2006 only - Sep 22 0:00 0 -
7.133 Rule Palestine 2007 only - Sep Thu>=8 2:00 0 -
7.134 -Rule Palestine 2008 max - Aug lastThu 2:00 0 -
7.135 +Rule Palestine 2008 only - Aug lastFri 2:00 0 -
7.136 +Rule Palestine 2009 max - Mar lastFri 0:00 1:00 S
7.137 +Rule Palestine 2009 max - Sep lastMon 2:00 0 -
7.138
7.139 # Zone NAME GMTOFF RULES FORMAT [UNTIL]
7.140 Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
7.141 @@ -1991,8 +2079,29 @@
7.142 # http://sana.sy/ara/2/2008/10/07/195459.htm
7.143 # </a>
7.144
7.145 -Rule Syria 2008 max - Apr Fri>=1 0:00 1:00 S
7.146 +# From Steffen Thorsen (2009-03-19):
7.147 +# Syria will start DST on 2009-03-27 00:00 this year according to many sources,
7.148 +# two examples:
7.149 +#
7.150 +# <a href="http://www.sana.sy/eng/21/2009/03/17/217563.htm">
7.151 +# http://www.sana.sy/eng/21/2009/03/17/217563.htm
7.152 +# </a>
7.153 +# (English, Syrian Arab News # Agency)
7.154 +# <a href="http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209">
7.155 +# http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209
7.156 +# </a>
7.157 +# (Arabic, gov-site)
7.158 +#
7.159 +# We have not found any sources saying anything about when DST ends this year.
7.160 +#
7.161 +# Our summary
7.162 +# <a href="http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html">
7.163 +# http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
7.164 +# </a>
7.165 +
7.166 +Rule Syria 2008 only - Apr Fri>=1 0:00 1:00 S
7.167 Rule Syria 2008 max - Nov 1 0:00 0 -
7.168 +Rule Syria 2009 max - Mar lastFri 0:00 1:00 S
7.169
7.170 # Zone NAME GMTOFF RULES FORMAT [UNTIL]
7.171 Zone Asia/Damascus 2:25:12 - LMT 1920 # Dimashq
8.1 --- a/make/sun/javazic/tzdata/leapseconds Thu May 21 18:41:50 2009 +0100
8.2 +++ b/make/sun/javazic/tzdata/leapseconds Tue Jun 09 23:47:38 2009 -0700
8.3 @@ -75,40 +75,32 @@
8.4 # SERVICE DE LA ROTATION TERRESTRE
8.5 # OBSERVATOIRE DE PARIS
8.6 # 61, Av. de l'Observatoire 75014 PARIS (France)
8.7 -# Tel. : 33 (0) 1 40 51 22 26
8.8 +# Tel. : 33 (0) 1 40 51 22 29
8.9 # FAX : 33 (0) 1 40 51 22 91
8.10 -# e-mail : services.iers@obspm.fr
8.11 -# http://hpiers.obspm.fr/eop-pc
8.12 +# Internet : services.iers@obspm.fr
8.13 #
8.14 -# Paris, 4 July 2008
8.15 +# Paris, 15 January 2009
8.16 #
8.17 -# Bulletin C 36
8.18 +# Bulletin C 37
8.19 #
8.20 # To authorities responsible
8.21 # for the measurement and
8.22 # distribution of time
8.23 #
8.24 -# UTC TIME STEP
8.25 -# on the 1st of January 2009
8.26 +# INFORMATION ON UTC - TAI
8.27 #
8.28 -# A positive leap second will be introduced at the end of December 2008.
8.29 -# The sequence of dates of the UTC second markers will be:
8.30 +# NO positive leap second will be introduced at the end of June 2009.
8.31 +# The difference between Coordinated Universal Time UTC and the
8.32 +# International Atomic Time TAI is :
8.33 #
8.34 -# 2008 December 31, 23h 59m 59s
8.35 -# 2008 December 31, 23h 59m 60s
8.36 -# 2009 January 1, 0h 0m 0s
8.37 -#
8.38 -# The difference between UTC and the International Atomic Time TAI is:
8.39 -#
8.40 -# from 2006 January 1, 0h UTC, to 2009 January 1 0h UTC : UTC-TAI = - 33s
8.41 -# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = - 34s
8.42 +# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
8.43 #
8.44 # Leap seconds can be introduced in UTC at the end of the months of December
8.45 -# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
8.46 -# six months, either to announce a time step in UTC or to confirm that there
8.47 +# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
8.48 +# six months, either to announce a time step in UTC, or to confirm that there
8.49 # will be no time step at the next possible date.
8.50 #
8.51 # Daniel GAMBIS
8.52 -# Head
8.53 -# Earth Orientation Center of IERS
8.54 +# Head
8.55 +# Earth Orientation Center of the IERS
8.56 # Observatoire de Paris, France
9.1 --- a/make/sun/javazic/tzdata/northamerica Thu May 21 18:41:50 2009 +0100
9.2 +++ b/make/sun/javazic/tzdata/northamerica Tue Jun 09 23:47:38 2009 -0700
9.3 @@ -2280,6 +2280,25 @@
9.4 # From Arthur David Olson (2008-03-12):
9.5 # Assume Sun>=15 (third Sunday) going forward.
9.6
9.7 +# From Alexander Krivenyshev (2009-03-04)
9.8 +# According to the Radio Reloj - Cuba will start Daylight Saving Time on
9.9 +# midnight between Saturday, March 07, 2009 and Sunday, March 08, 2009-
9.10 +# not on midnight March 14 / March 15 as previously thought.
9.11 +#
9.12 +# <a href="http://www.worldtimezone.com/dst_news/dst_news_cuba05.html">
9.13 +# http://www.worldtimezone.com/dst_news/dst_news_cuba05.html
9.14 +# (in Spanish)
9.15 +# </a>
9.16 +
9.17 +# From Arthur David Olson (2009-03-09)
9.18 +# I listened over the Internet to
9.19 +# <a href="http://media.enet.cu/readioreloj">
9.20 +# http://media.enet.cu/readioreloj
9.21 +# </a>
9.22 +# this morning; when it was 10:05 a. m. here in Bethesda, Maryland the
9.23 +# the time was announced as "diez cinco"--the same time as here, indicating
9.24 +# that has indeed switched to DST. Assume second Sunday from 2009 forward.
9.25 +
9.26 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
9.27 Rule Cuba 1928 only - Jun 10 0:00 1:00 D
9.28 Rule Cuba 1928 only - Oct 10 0:00 0 S
9.29 @@ -2312,7 +2331,8 @@
9.30 Rule Cuba 2000 2004 - Apr Sun>=1 0:00s 1:00 D
9.31 Rule Cuba 2006 max - Oct lastSun 0:00s 0 S
9.32 Rule Cuba 2007 only - Mar Sun>=8 0:00s 1:00 D
9.33 -Rule Cuba 2008 max - Mar Sun>=15 0:00s 1:00 D
9.34 +Rule Cuba 2008 only - Mar Sun>=15 0:00s 1:00 D
9.35 +Rule Cuba 2009 max - Mar Sun>=8 0:00s 1:00 D
9.36
9.37 # Zone NAME GMTOFF RULES FORMAT [UNTIL]
9.38 Zone America/Havana -5:29:28 - LMT 1890
10.1 --- a/make/sun/javazic/tzdata/southamerica Thu May 21 18:41:50 2009 +0100
10.2 +++ b/make/sun/javazic/tzdata/southamerica Tue Jun 09 23:47:38 2009 -0700
10.3 @@ -373,6 +373,50 @@
10.4 # keep America/Cordoba a single region rather than splitting it into the
10.5 # other 5 subregions.
10.6
10.7 +# From Mariano Absatz (2009-03-13):
10.8 +# Yesterday (with our usual 2-day notice) the Province of San Luis
10.9 +# decided that next Sunday instead of "staying" @utc-03:00 they will go
10.10 +# to utc-04:00 until the second Saturday in October...
10.11 +#
10.12 +# The press release is at
10.13 +# <a href="http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102">
10.14 +# http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102
10.15 +# </a>
10.16 +# (I couldn't find the decree, but
10.17 +# <a href="http://www.sanluis.gov.ar">
10.18 +# www.sanluis.gov.ar
10.19 +# <a/>
10.20 +# is the official page for the Province Government).
10.21 +#
10.22 +# There's also a note in only one of the major national papers (La Nación) at
10.23 +# <a href="http://www.lanacion.com.ar/nota.asp?nota_id=1107912">
10.24 +# http://www.lanacion.com.ar/nota.asp?nota_id=1107912
10.25 +# </a>
10.26 +#
10.27 +# The press release says:
10.28 +# (...) anunció que el próximo domingo a las 00:00 los puntanos deberán
10.29 +# atrasar una hora sus relojes.
10.30 +#
10.31 +# A partir de entonces, San Luis establecerá el huso horario propio de
10.32 +# la Provincia. De esta manera, durante el periodo del calendario anual
10.33 +# 2009, el cambio horario quedará comprendido entre las 00:00 del tercer
10.34 +# domingo de marzo y las 24:00 del segundo sábado de octubre.
10.35 +# Quick&dirty translation
10.36 +# (...) announced that next Sunday, at 00:00, Puntanos (the San Luis
10.37 +# inhabitants) will have to turn back one hour their clocks
10.38 +#
10.39 +# Since then, San Luis will establish its own Province timezone. Thus,
10.40 +# during 2009, this timezone change will run from 00:00 the third Sunday
10.41 +# in March until 24:00 of the second Saturday in October.
10.42 +
10.43 +# From Arthur David Olson (2009-03-16):
10.44 +# The unofficial claim at
10.45 +# <a href="http://www.timeanddate.com/news/time/san-luis-new-time-zone.html">
10.46 +# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
10.47 +# </a>
10.48 +# is that "The province will most likely follow the next daylight saving schedule,
10.49 +# which is planned for the second Sunday in October."
10.50 +
10.51 #
10.52 # Zone NAME GMTOFF RULES FORMAT [UNTIL]
10.53 #
10.54 @@ -520,7 +564,8 @@
10.55 -3:00 - ART 2004 May 31
10.56 -4:00 - WART 2004 Jul 25
10.57 -3:00 Arg AR%sT 2008 Jan 21
10.58 - -3:00 - ART
10.59 + -3:00 - ART 2009 Mar 15
10.60 + -4:00 Arg WAR%sT
10.61 #
10.62 # Santa Cruz (SC)
10.63 Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31
11.1 --- a/make/sun/xawt/mapfile-vers Thu May 21 18:41:50 2009 +0100
11.2 +++ b/make/sun/xawt/mapfile-vers Tue Jun 09 23:47:38 2009 -0700
11.3 @@ -128,6 +128,7 @@
11.4 Java_sun_awt_X11_XlibWrapper_SetToolkitErrorHandler;
11.5 Java_sun_awt_X11_XlibWrapper_XSetErrorHandler;
11.6 Java_sun_awt_X11_XlibWrapper_CallErrorHandler;
11.7 + Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent;
11.8 Java_sun_awt_X11_XlibWrapper_XInternAtoms;
11.9 Java_sun_awt_X11_XlibWrapper_XChangeWindowAttributes;
11.10 Java_sun_awt_X11_XlibWrapper_XDeleteProperty;
11.11 @@ -154,7 +155,7 @@
11.12 Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl;
11.13 Java_sun_awt_X11_XRobotPeer_mouseWheelImpl;
11.14 Java_sun_awt_X11_XRobotPeer_setup;
11.15 - Java_sun_awt_X11_XRobotPeer_getNumberOfButtonsImpl;
11.16 + Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl;
11.17 Java_java_awt_Component_initIDs;
11.18 Java_java_awt_Container_initIDs;
11.19 Java_java_awt_Button_initIDs;
11.20 @@ -276,7 +277,6 @@
11.21 Java_sun_awt_X11_XToolkit_getDefaultXColormap;
11.22 Java_sun_awt_X11_XToolkit_getDefaultScreenData;
11.23 Java_sun_awt_X11_XToolkit_getEnv;
11.24 - Java_sun_awt_X11_XToolkit_setNoisyXErrorHandler;
11.25 Java_sun_awt_X11_XlibWrapper_XCreateBitmapFromData;
11.26 Java_sun_awt_X11_XlibWrapper_XFreePixmap;
11.27 Java_sun_awt_X11_XlibWrapper_XAllocColor;
12.1 --- a/src/share/classes/java/awt/Component.java Thu May 21 18:41:50 2009 +0100
12.2 +++ b/src/share/classes/java/awt/Component.java Tue Jun 09 23:47:38 2009 -0700
12.3 @@ -1038,13 +1038,23 @@
12.4
12.5 void setGraphicsConfiguration(GraphicsConfiguration gc) {
12.6 synchronized(getTreeLock()) {
12.7 - graphicsConfig = gc;
12.8 -
12.9 - ComponentPeer peer = getPeer();
12.10 - if (peer != null) {
12.11 - peer.updateGraphicsData(gc);
12.12 - }
12.13 - }
12.14 + if (updateGraphicsData(gc)) {
12.15 + removeNotify();
12.16 + addNotify();
12.17 + }
12.18 + }
12.19 + }
12.20 +
12.21 + boolean updateGraphicsData(GraphicsConfiguration gc) {
12.22 + checkTreeLock();
12.23 +
12.24 + graphicsConfig = gc;
12.25 +
12.26 + ComponentPeer peer = getPeer();
12.27 + if (peer != null) {
12.28 + return peer.updateGraphicsData(gc);
12.29 + }
12.30 + return false;
12.31 }
12.32
12.33 /**
13.1 --- a/src/share/classes/java/awt/Container.java Thu May 21 18:41:50 2009 +0100
13.2 +++ b/src/share/classes/java/awt/Container.java Tue Jun 09 23:47:38 2009 -0700
13.3 @@ -1113,16 +1113,17 @@
13.4 }
13.5
13.6 @Override
13.7 - void setGraphicsConfiguration(GraphicsConfiguration gc) {
13.8 - synchronized (getTreeLock()) {
13.9 - super.setGraphicsConfiguration(gc);
13.10 -
13.11 - for (Component comp : component) {
13.12 - if (comp != null) {
13.13 - comp.setGraphicsConfiguration(gc);
13.14 - }
13.15 + boolean updateGraphicsData(GraphicsConfiguration gc) {
13.16 + checkTreeLock();
13.17 +
13.18 + boolean ret = super.updateGraphicsData(gc);
13.19 +
13.20 + for (Component comp : component) {
13.21 + if (comp != null) {
13.22 + ret |= comp.updateGraphicsData(gc);
13.23 }
13.24 }
13.25 + return ret;
13.26 }
13.27
13.28 /**
14.1 --- a/src/share/classes/java/awt/GraphicsConfiguration.java Thu May 21 18:41:50 2009 +0100
14.2 +++ b/src/share/classes/java/awt/GraphicsConfiguration.java Tue Jun 09 23:47:38 2009 -0700
14.3 @@ -436,7 +436,7 @@
14.4 }
14.5
14.6 /**
14.7 - * Returns whether this GraphicsConfiguration supports
14.8 + * Returns whether this {@code GraphicsConfiguration} supports
14.9 * the {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
14.10 * PERPIXEL_TRANSLUCENT} kind of translucency.
14.11 *
15.1 --- a/src/share/classes/java/awt/GraphicsDevice.java Thu May 21 18:41:50 2009 +0100
15.2 +++ b/src/share/classes/java/awt/GraphicsDevice.java Tue Jun 09 23:47:38 2009 -0700
15.3 @@ -246,7 +246,7 @@
15.4 * Simulated full-screen mode resizes
15.5 * the window to the size of the screen and positions it at (0,0).
15.6 * <p>
15.7 - * When entering full-screen mode, if the window to be used as the
15.8 + * When entering full-screen mode, if the window to be used as a
15.9 * full-screen window is not visible, this method will make it visible.
15.10 * It will remain visible when returning to windowed mode.
15.11 * <p>
15.12 @@ -261,9 +261,9 @@
15.13 *
15.14 * @param w a window to use as the full-screen window; {@code null}
15.15 * if returning to windowed mode. Some platforms expect the
15.16 - * fullscreen window to be a top-level component (i.e., a Frame);
15.17 - * therefore it is preferable to use a Frame here rather than a
15.18 - * Window.
15.19 + * fullscreen window to be a top-level component (i.e., a {@code Frame});
15.20 + * therefore it is preferable to use a {@code Frame} here rather than a
15.21 + * {@code Window}.
15.22 *
15.23 * @see #isFullScreenSupported
15.24 * @see #getFullScreenWindow
16.1 --- a/src/share/classes/java/awt/Robot.java Thu May 21 18:41:50 2009 +0100
16.2 +++ b/src/share/classes/java/awt/Robot.java Tue Jun 09 23:47:38 2009 -0700
16.3 @@ -96,9 +96,13 @@
16.4 init(GraphicsEnvironment.getLocalGraphicsEnvironment()
16.5 .getDefaultScreenDevice());
16.6 int tmpMask = 0;
16.7 +
16.8 if (Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
16.9 - for (int i = 0; i < peer.getNumberOfButtons(); i++){
16.10 - tmpMask |= InputEvent.getMaskForButton(i+1);
16.11 + if (Toolkit.getDefaultToolkit() instanceof SunToolkit) {
16.12 + final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
16.13 + for (int i = 0; i < buttonsNumber; i++){
16.14 + tmpMask |= InputEvent.getMaskForButton(i+1);
16.15 + }
16.16 }
16.17 }
16.18 tmpMask |= InputEvent.BUTTON1_MASK|
17.1 --- a/src/share/classes/java/awt/Window.java Thu May 21 18:41:50 2009 +0100
17.2 +++ b/src/share/classes/java/awt/Window.java Tue Jun 09 23:47:38 2009 -0700
17.3 @@ -296,7 +296,7 @@
17.4 transient boolean isInShow = false;
17.5
17.6 /*
17.7 - * Opacity level of the window
17.8 + * The opacity level of the window
17.9 *
17.10 * @serial
17.11 * @see #setOpacity(float)
17.12 @@ -306,7 +306,7 @@
17.13 private float opacity = 1.0f;
17.14
17.15 /*
17.16 - * The shape assigned to this window. This field is set to null if
17.17 + * The shape assigned to this window. This field is set to {@code null} if
17.18 * no shape is set (rectangular window).
17.19 *
17.20 * @serial
17.21 @@ -3592,10 +3592,10 @@
17.22 @Override
17.23 public void setBackground(Color bgColor) {
17.24 Color oldBg = getBackground();
17.25 + super.setBackground(bgColor);
17.26 if (oldBg != null && oldBg.equals(bgColor)) {
17.27 return;
17.28 }
17.29 - super.setBackground(bgColor);
17.30 int oldAlpha = oldBg != null ? oldBg.getAlpha() : 255;
17.31 int alpha = bgColor.getAlpha();
17.32 if ((oldAlpha == 255) && (alpha < 255)) { // non-opaque window
17.33 @@ -3623,16 +3623,37 @@
17.34 }
17.35 }
17.36
17.37 - private void updateWindow(BufferedImage backBuffer) {
17.38 + private void updateWindow() {
17.39 synchronized (getTreeLock()) {
17.40 WindowPeer peer = (WindowPeer)getPeer();
17.41 if (peer != null) {
17.42 - peer.updateWindow(backBuffer);
17.43 + peer.updateWindow();
17.44 }
17.45 }
17.46 }
17.47
17.48 - private static final Color TRANSPARENT_BACKGROUND_COLOR = new Color(0, 0, 0, 0);
17.49 + /**
17.50 + * {@inheritDoc}
17.51 + *
17.52 + * @since 1.7
17.53 + */
17.54 + @Override
17.55 + public void paint(Graphics g) {
17.56 + Color bgColor = getBackground();
17.57 + if ((bgColor != null) && (bgColor.getAlpha() < 255)) {
17.58 + Graphics gg = g.create();
17.59 + try {
17.60 + if (gg instanceof Graphics2D) {
17.61 + gg.setColor(bgColor);
17.62 + ((Graphics2D)gg).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC));
17.63 + gg.fillRect(0, 0, getWidth(), getHeight());
17.64 + }
17.65 + } finally {
17.66 + gg.dispose();
17.67 + }
17.68 + }
17.69 + super.paint(g);
17.70 + }
17.71
17.72 private static void setLayersOpaque(Component component, boolean isOpaque) {
17.73 // Shouldn't use instanceof to avoid loading Swing classes
17.74 @@ -3644,18 +3665,10 @@
17.75 Container c = root.getContentPane();
17.76 javax.swing.JComponent content =
17.77 (c instanceof javax.swing.JComponent) ? (javax.swing.JComponent)c : null;
17.78 - javax.swing.JComponent gp =
17.79 - (rpc.getGlassPane() instanceof javax.swing.JComponent) ?
17.80 - (javax.swing.JComponent)rpc.getGlassPane() : null;
17.81 - if (gp != null) {
17.82 - gp.setDoubleBuffered(isOpaque);
17.83 - }
17.84 lp.setOpaque(isOpaque);
17.85 root.setOpaque(isOpaque);
17.86 - root.setDoubleBuffered(isOpaque);
17.87 if (content != null) {
17.88 content.setOpaque(isOpaque);
17.89 - content.setDoubleBuffered(isOpaque);
17.90
17.91 // Iterate down one level to see whether we have a JApplet
17.92 // (which is also a RootPaneContainer) which requires processing
17.93 @@ -3748,8 +3761,8 @@
17.94 window.setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue(),
17.95 opaque ? 255 : 0));
17.96 }
17.97 - public void updateWindow(Window window, BufferedImage backBuffer) {
17.98 - window.updateWindow(backBuffer);
17.99 + public void updateWindow(Window window) {
17.100 + window.updateWindow();
17.101 }
17.102
17.103 public Dimension getSecurityWarningSize(Window window) {
18.1 --- a/src/share/classes/java/awt/event/InputEvent.java Thu May 21 18:41:50 2009 +0100
18.2 +++ b/src/share/classes/java/awt/event/InputEvent.java Tue Jun 09 23:47:38 2009 -0700
18.3 @@ -157,6 +157,8 @@
18.4 /**
18.5 * An array of extended modifiers for additional buttons.
18.6 * @see getButtonDownMasks
18.7 + * There are twenty buttons fit into 4byte space.
18.8 + * one more bit is reserved for FIRST_HIGH_BIT.
18.9 * @since 7.0
18.10 */
18.11 private static final int [] BUTTON_DOWN_MASK = new int [] { BUTTON1_DOWN_MASK,
18.12 @@ -169,7 +171,16 @@
18.13 1<<18,
18.14 1<<19,
18.15 1<<20,
18.16 - 1<<21 };
18.17 + 1<<21,
18.18 + 1<<22,
18.19 + 1<<23,
18.20 + 1<<24,
18.21 + 1<<25,
18.22 + 1<<26,
18.23 + 1<<27,
18.24 + 1<<28,
18.25 + 1<<29,
18.26 + 1<<30};
18.27
18.28 /**
18.29 * A method to access an array of extended modifiers for additional buttons.
18.30 @@ -240,7 +251,7 @@
18.31 // in fact, it is undesirable to add modifier bits
18.32 // to the same field as this may break applications
18.33 // see bug# 5066958
18.34 - static final int FIRST_HIGH_BIT = 1 << 22;
18.35 + static final int FIRST_HIGH_BIT = 1 << 31;
18.36
18.37 static final int JDK_1_3_MODIFIERS = SHIFT_DOWN_MASK - 1;
18.38 static final int HIGH_MODIFIERS = ~( FIRST_HIGH_BIT - 1 );
19.1 --- a/src/share/classes/java/awt/event/MouseEvent.java Thu May 21 18:41:50 2009 +0100
19.2 +++ b/src/share/classes/java/awt/event/MouseEvent.java Tue Jun 09 23:47:38 2009 -0700
19.3 @@ -33,6 +33,7 @@
19.4 import java.io.ObjectInputStream;
19.5 import java.awt.IllegalComponentStateException;
19.6 import java.awt.MouseInfo;
19.7 +import sun.awt.SunToolkit;
19.8
19.9 /**
19.10 * An event which indicates that a mouse action occurred in a component.
19.11 @@ -379,12 +380,25 @@
19.12 */
19.13 private static final long serialVersionUID = -991214153494842848L;
19.14
19.15 + /**
19.16 + * A number of buttons available on the mouse at the {@code Toolkit} machinery startup.
19.17 + */
19.18 + private static int cachedNumberOfButtons;
19.19 +
19.20 static {
19.21 /* ensure that the necessary native libraries are loaded */
19.22 NativeLibLoader.loadLibraries();
19.23 if (!GraphicsEnvironment.isHeadless()) {
19.24 initIDs();
19.25 }
19.26 + final Toolkit tk = Toolkit.getDefaultToolkit();
19.27 + if (tk instanceof SunToolkit) {
19.28 + cachedNumberOfButtons = ((SunToolkit)tk).getNumberOfButtons();
19.29 + } else {
19.30 + //It's expected that some toolkits (Headless,
19.31 + //whatever besides SunToolkit) could also operate.
19.32 + cachedNumberOfButtons = 3;
19.33 + }
19.34 }
19.35
19.36 /**
19.37 @@ -412,15 +426,6 @@
19.38 }
19.39
19.40 /**
19.41 - * A number of buttons available on the mouse at the {@code Toolkit} machinery startup.
19.42 - */
19.43 - private static int cachedNumberOfButtons;
19.44 -
19.45 - static {
19.46 - cachedNumberOfButtons = MouseInfo.getNumberOfButtons();
19.47 - }
19.48 -
19.49 - /**
19.50 * Returns the absolute horizontal x position of the event.
19.51 * In a virtual device multi-screen environment in which the
19.52 * desktop area could span multiple physical screen devices,
19.53 @@ -735,7 +740,6 @@
19.54 if (button < NOBUTTON){
19.55 throw new IllegalArgumentException("Invalid button value :" + button);
19.56 }
19.57 - //TODO: initialize MouseInfo.cachedNumber on toolkit creation.
19.58 if (button > BUTTON3) {
19.59 if (!Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
19.60 throw new IllegalArgumentException("Extra mouse events are disabled " + button);
20.1 --- a/src/share/classes/java/awt/peer/ComponentPeer.java Thu May 21 18:41:50 2009 +0100
20.2 +++ b/src/share/classes/java/awt/peer/ComponentPeer.java Tue Jun 09 23:47:38 2009 -0700
20.3 @@ -548,7 +548,8 @@
20.4 /**
20.5 * Updates internal data structures related to the component's GC.
20.6 *
20.7 + * @return if the peer needs to be recreated for the changes to take effect
20.8 * @since 1.7
20.9 */
20.10 - void updateGraphicsData(GraphicsConfiguration gc);
20.11 + boolean updateGraphicsData(GraphicsConfiguration gc);
20.12 }
21.1 --- a/src/share/classes/java/awt/peer/RobotPeer.java Thu May 21 18:41:50 2009 +0100
21.2 +++ b/src/share/classes/java/awt/peer/RobotPeer.java Tue Jun 09 23:47:38 2009 -0700
21.3 @@ -121,11 +121,4 @@
21.4 * Disposes the robot peer when it is not needed anymore.
21.5 */
21.6 void dispose();
21.7 -
21.8 - /**
21.9 - * Returns the number of buttons that the robot simulates.
21.10 - *
21.11 - * @return the number of buttons that the robot simulates
21.12 - */
21.13 - int getNumberOfButtons();
21.14 }
22.1 --- a/src/share/classes/java/awt/peer/WindowPeer.java Thu May 21 18:41:50 2009 +0100
22.2 +++ b/src/share/classes/java/awt/peer/WindowPeer.java Tue Jun 09 23:47:38 2009 -0700
22.3 @@ -110,12 +110,11 @@
22.4 void setOpaque(boolean isOpaque);
22.5
22.6 /**
22.7 - * Updates the native part of non-opaque window using
22.8 - * the given image with color+alpha values for each pixel.
22.9 + * Updates the native part of non-opaque window.
22.10 *
22.11 * @see Window#setBackground(Color)
22.12 */
22.13 - void updateWindow(BufferedImage backBuffer);
22.14 + void updateWindow();
22.15
22.16 /**
22.17 * Instructs the peer to update the position of the security warning.
23.1 --- a/src/share/classes/javax/swing/DefaultDesktopManager.java Thu May 21 18:41:50 2009 +0100
23.2 +++ b/src/share/classes/javax/swing/DefaultDesktopManager.java Tue Jun 09 23:47:38 2009 -0700
23.3 @@ -34,6 +34,9 @@
23.4 import java.awt.event.ComponentAdapter;
23.5 import java.awt.event.ComponentEvent;
23.6
23.7 +import sun.awt.AWTAccessor;
23.8 +import sun.awt.SunToolkit;
23.9 +
23.10 /** This is an implementation of the <code>DesktopManager</code>.
23.11 * It currently implements the basic behaviors for managing
23.12 * <code>JInternalFrame</code>s in an arbitrary parent.
23.13 @@ -361,7 +364,7 @@
23.14 g.dispose();
23.15 }
23.16 } else if (dragMode == FASTER_DRAG_MODE) {
23.17 - dragFrameFaster(f, newX, newY);
23.18 + dragFrameFaster(f, newX, newY);
23.19 } else {
23.20 setBoundsForFrame(f, newX, newY, f.getWidth(), f.getHeight());
23.21 }
23.22 @@ -634,13 +637,8 @@
23.23
23.24 boolean floaterCollision = isFloaterCollision(previousBounds, currentBounds);
23.25
23.26 - // System.out.println(previousBounds);
23.27 JComponent parent = (JComponent)f.getParent();
23.28 Rectangle visBounds = previousBounds.intersection(desktopBounds);
23.29 - // System.out.println(previousBounds);
23.30 -
23.31 -
23.32 - // System.out.println(visBounds);
23.33
23.34 RepaintManager currentManager = RepaintManager.currentManager(f);
23.35
23.36 @@ -682,7 +680,6 @@
23.37 } else {
23.38 dirtyRects = new Rectangle[1];
23.39 dirtyRects[0] = previousBounds;
23.40 - // System.out.println("no intersection");
23.41 };
23.42
23.43 // Fix the damage
23.44 @@ -701,14 +698,22 @@
23.45
23.46 parent.paintImmediately(dirtyRects[i]);
23.47 ((JInternalFrame)f).isDragging = true;
23.48 -
23.49 - // System.out.println(dirtyRects[i]);
23.50 }
23.51
23.52 }
23.53 } finally {
23.54 currentManager.endPaint();
23.55 }
23.56 +
23.57 + // update window if it's non-opaque
23.58 + Window topLevel = SwingUtilities.getWindowAncestor(f);
23.59 + Toolkit tk = Toolkit.getDefaultToolkit();
23.60 + if (!AWTAccessor.getWindowAccessor().isOpaque(topLevel) &&
23.61 + (tk instanceof SunToolkit) &&
23.62 + ((SunToolkit)tk).needUpdateWindow())
23.63 + {
23.64 + AWTAccessor.getWindowAccessor().updateWindow(topLevel);
23.65 + }
23.66 }
23.67
23.68 private boolean isFloaterCollision(Rectangle moveFrom, Rectangle moveTo) {
24.1 --- a/src/share/classes/javax/swing/JComponent.java Thu May 21 18:41:50 2009 +0100
24.2 +++ b/src/share/classes/javax/swing/JComponent.java Tue Jun 09 23:47:38 2009 -0700
24.3 @@ -1021,8 +1021,10 @@
24.4
24.5 int bw,bh;
24.6 boolean printing = getFlag(IS_PRINTING);
24.7 - if(!printing && repaintManager.isDoubleBufferingEnabled() &&
24.8 - !getFlag(ANCESTOR_USING_BUFFER) && isDoubleBuffered()) {
24.9 + if (!printing && repaintManager.isDoubleBufferingEnabled() &&
24.10 + !getFlag(ANCESTOR_USING_BUFFER) && isDoubleBuffered() &&
24.11 + (getFlag(IS_REPAINTING) || repaintManager.isPainting()))
24.12 + {
24.13 repaintManager.beginPaint();
24.14 try {
24.15 repaintManager.paint(this, this, co, clipX, clipY, clipW,
25.1 --- a/src/share/classes/javax/swing/RepaintManager.java Thu May 21 18:41:50 2009 +0100
25.2 +++ b/src/share/classes/javax/swing/RepaintManager.java Tue Jun 09 23:47:38 2009 -0700
25.3 @@ -43,7 +43,6 @@
25.4
25.5 import com.sun.java.swing.SwingUtilities3;
25.6
25.7 -
25.8 /**
25.9 * This class manages repaint requests, allowing the number
25.10 * of repaints to be minimized, for example by collapsing multiple
25.11 @@ -717,14 +716,12 @@
25.12 }
25.13 }
25.14
25.15 - private Map<Component,Rectangle>
25.16 - updateWindows(Map<Component,Rectangle> dirtyComponents)
25.17 - {
25.18 + private void updateWindows(Map<Component,Rectangle> dirtyComponents) {
25.19 Toolkit toolkit = Toolkit.getDefaultToolkit();
25.20 if (!(toolkit instanceof SunToolkit &&
25.21 ((SunToolkit)toolkit).needUpdateWindow()))
25.22 {
25.23 - return dirtyComponents;
25.24 + return;
25.25 }
25.26
25.27 Set<Window> windows = new HashSet<Window>();
25.28 @@ -734,25 +731,20 @@
25.29 Window window = dirty instanceof Window ?
25.30 (Window)dirty :
25.31 SwingUtilities.getWindowAncestor(dirty);
25.32 -
25.33 if (window != null &&
25.34 !AWTAccessor.getWindowAccessor().isOpaque(window))
25.35 {
25.36 - // if this component's toplevel is perpixel translucent, it will
25.37 - // be repainted below
25.38 - it.remove();
25.39 - // add to the set of windows to update (so that we don't update
25.40 - // the window many times for each component to be repainted that
25.41 - // belongs to this window)
25.42 windows.add(window);
25.43 }
25.44 }
25.45
25.46 for (Window window : windows) {
25.47 - AWTAccessor.getWindowAccessor().updateWindow(window, null);
25.48 + AWTAccessor.getWindowAccessor().updateWindow(window);
25.49 }
25.50 + }
25.51
25.52 - return dirtyComponents;
25.53 + boolean isPainting() {
25.54 + return painting;
25.55 }
25.56
25.57 /**
25.58 @@ -788,10 +780,6 @@
25.59 int localBoundsW;
25.60 Enumeration keys;
25.61
25.62 - // the components belonging to perpixel-translucent windows will be
25.63 - // removed from the list
25.64 - tmpDirtyComponents = updateWindows(tmpDirtyComponents);
25.65 -
25.66 roots = new ArrayList<Component>(count);
25.67
25.68 for (Component dirty : tmpDirtyComponents.keySet()) {
25.69 @@ -799,13 +787,11 @@
25.70 }
25.71
25.72 count = roots.size();
25.73 - // System.out.println("roots size is " + count);
25.74 painting = true;
25.75 try {
25.76 for(i=0 ; i < count ; i++) {
25.77 dirtyComponent = roots.get(i);
25.78 rect = tmpDirtyComponents.get(dirtyComponent);
25.79 - // System.out.println("Should refresh :" + rect);
25.80 localBoundsH = dirtyComponent.getHeight();
25.81 localBoundsW = dirtyComponent.getWidth();
25.82
25.83 @@ -848,6 +834,9 @@
25.84 } finally {
25.85 painting = false;
25.86 }
25.87 +
25.88 + updateWindows(tmpDirtyComponents);
25.89 +
25.90 tmpDirtyComponents.clear();
25.91 }
25.92
25.93 @@ -1004,6 +993,16 @@
25.94 return delegate.getVolatileOffscreenBuffer(c, proposedWidth,
25.95 proposedHeight);
25.96 }
25.97 +
25.98 + // If the window is non-opaque, it's double-buffered at peer's level
25.99 + Window w = (c instanceof Window) ? (Window)c : SwingUtilities.getWindowAncestor(c);
25.100 + if (!AWTAccessor.getWindowAccessor().isOpaque(w)) {
25.101 + Toolkit tk = Toolkit.getDefaultToolkit();
25.102 + if ((tk instanceof SunToolkit) && (((SunToolkit)tk).needUpdateWindow())) {
25.103 + return null;
25.104 + }
25.105 + }
25.106 +
25.107 GraphicsConfiguration config = c.getGraphicsConfiguration();
25.108 if (config == null) {
25.109 config = GraphicsEnvironment.getLocalGraphicsEnvironment().
25.110 @@ -1031,6 +1030,15 @@
25.111 DoubleBufferInfo doubleBuffer;
25.112 int width, height;
25.113
25.114 + // If the window is non-opaque, it's double-buffered at peer's level
25.115 + Window w = (c instanceof Window) ? (Window)c : SwingUtilities.getWindowAncestor(c);
25.116 + if (!AWTAccessor.getWindowAccessor().isOpaque(w)) {
25.117 + Toolkit tk = Toolkit.getDefaultToolkit();
25.118 + if ((tk instanceof SunToolkit) && (((SunToolkit)tk).needUpdateWindow())) {
25.119 + return null;
25.120 + }
25.121 + }
25.122 +
25.123 if (standardDoubleBuffer == null) {
25.124 standardDoubleBuffer = new DoubleBufferInfo();
25.125 }
26.1 --- a/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java Thu May 21 18:41:50 2009 +0100
26.2 +++ b/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java Tue Jun 09 23:47:38 2009 -0700
26.3 @@ -230,51 +230,46 @@
26.4 }
26.5
26.6 public void run0() {
26.7 - DoChangeContents doChangeContents = ShellFolder.getInvoker().invoke(new Callable<DoChangeContents>() {
26.8 - public DoChangeContents call() throws Exception {
26.9 - FileSystemView fileSystem = filechooser.getFileSystemView();
26.10 + FileSystemView fileSystem = filechooser.getFileSystemView();
26.11
26.12 - File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
26.13 + File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
26.14
26.15 - Vector<File> acceptsList = new Vector<File>();
26.16 + if (isInterrupted()) {
26.17 + return;
26.18 + }
26.19
26.20 - if (isInterrupted()) {
26.21 - return null;
26.22 - }
26.23 + final Vector<File> newFileCache = new Vector<File>();
26.24 + Vector<File> newFiles = new Vector<File>();
26.25
26.26 - // run through the file list, add directories and selectable files to fileCache
26.27 - for (File file : list) {
26.28 - if (filechooser.accept(file)) {
26.29 - acceptsList.addElement(file);
26.30 - }
26.31 + // run through the file list, add directories and selectable files to fileCache
26.32 + // Note that this block must be OUTSIDE of Invoker thread because of
26.33 + // deadlock possibility with custom synchronized FileSystemView
26.34 + for (File file : list) {
26.35 + if (filechooser.accept(file)) {
26.36 + boolean isTraversable = filechooser.isTraversable(file);
26.37 +
26.38 + if (isTraversable) {
26.39 + newFileCache.addElement(file);
26.40 + } else if (filechooser.isFileSelectionEnabled()) {
26.41 + newFiles.addElement(file);
26.42 }
26.43
26.44 if (isInterrupted()) {
26.45 - return null;
26.46 + return;
26.47 }
26.48 + }
26.49 + }
26.50
26.51 - // First sort alphabetically by filename
26.52 - sort(acceptsList);
26.53 + // First sort alphabetically by filename
26.54 + sort(newFileCache);
26.55 + sort(newFiles);
26.56
26.57 - Vector<File> newDirectories = new Vector<File>(50);
26.58 - Vector<File> newFiles = new Vector<File>();
26.59 - // run through list grabbing directories in chunks of ten
26.60 - for (int i = 0; i < acceptsList.size(); i++) {
26.61 - File f = acceptsList.elementAt(i);
26.62 - boolean isTraversable = filechooser.isTraversable(f);
26.63 - if (isTraversable) {
26.64 - newDirectories.addElement(f);
26.65 - } else if (!isTraversable && filechooser.isFileSelectionEnabled()) {
26.66 - newFiles.addElement(f);
26.67 - }
26.68 - if (isInterrupted()) {
26.69 - return null;
26.70 - }
26.71 - }
26.72 + newFileCache.addAll(newFiles);
26.73
26.74 - Vector<File> newFileCache = new Vector<File>(newDirectories);
26.75 - newFileCache.addAll(newFiles);
26.76 -
26.77 + // To avoid loads of synchronizations with Invoker and improve performance we
26.78 + // execute the whole block on the COM thread
26.79 + DoChangeContents doChangeContents = ShellFolder.getInvoker().invoke(new Callable<DoChangeContents>() {
26.80 + public DoChangeContents call() throws Exception {
26.81 int newSize = newFileCache.size();
26.82 int oldSize = fileCache.size();
26.83
27.1 --- a/src/share/classes/javax/swing/plaf/nimbus/skin.laf Thu May 21 18:41:50 2009 +0100
27.2 +++ b/src/share/classes/javax/swing/plaf/nimbus/skin.laf Tue Jun 09 23:47:38 2009 -0700
27.3 @@ -4201,8 +4201,9 @@
27.4 <stateType key="Disabled"/>
27.5 <stateType key="Focused"/>
27.6 <stateType key="Editable">
27.7 - <codeSnippet><![CDATA[
27.8 - return ((JComboBox)c).isEditable();]]></codeSnippet>
27.9 + <codeSnippet><![CDATA[
27.10 + return c instanceof JComboBox && ((JComboBox)c).isEditable();
27.11 + ]]></codeSnippet>
27.12 </stateType>
27.13 </stateTypes>
27.14 <contentMargins top="0" bottom="0" left="0" right="0"/>
27.15 @@ -16160,12 +16161,14 @@
27.16 <stateType key="Disabled"/>
27.17 <stateType key="Indeterminate">
27.18 <codeSnippet><![CDATA[
27.19 - return ((JProgressBar)c).isIndeterminate();
27.20 + return c instanceof JProgressBar &&
27.21 + ((JProgressBar)c).isIndeterminate();
27.22 ]]></codeSnippet>
27.23 </stateType>
27.24 <stateType key="Finished">
27.25 <codeSnippet><![CDATA[
27.26 - return ((JProgressBar)c).getPercentComplete() == 1.0;
27.27 + return c instanceof JProgressBar &&
27.28 + ((JProgressBar)c).getPercentComplete() == 1.0;
27.29 ]]></codeSnippet>
27.30 </stateType>
27.31 </stateTypes>
27.32 @@ -25845,26 +25848,26 @@
27.33 <stateTypes>
27.34 <stateType key="North">
27.35 <codeSnippet><![CDATA[
27.36 - JToolBar toolbar = (JToolBar)c;
27.37 - return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.NORTH;
27.38 + return (c instanceof JToolBar) &&
27.39 + NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.NORTH;
27.40 ]]></codeSnippet>
27.41 </stateType>
27.42 <stateType key="East">
27.43 <codeSnippet><![CDATA[
27.44 - JToolBar toolbar = (JToolBar)c;
27.45 - return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.EAST;
27.46 + return (c instanceof JToolBar) &&
27.47 + NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.EAST;
27.48 ]]></codeSnippet>
27.49 </stateType>
27.50 <stateType key="West">
27.51 <codeSnippet><![CDATA[
27.52 - JToolBar toolbar = (JToolBar)c;
27.53 - return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.WEST;
27.54 + return (c instanceof JToolBar) &&
27.55 + NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.WEST;
27.56 ]]></codeSnippet>
27.57 </stateType>
27.58 <stateType key="South">
27.59 <codeSnippet><![CDATA[
27.60 - JToolBar toolbar = (JToolBar)c;
27.61 - return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.SOUTH;
27.62 + return (c instanceof JToolBar) &&
27.63 + NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.SOUTH;
27.64 ]]></codeSnippet>
27.65 </stateType>
27.66 </stateTypes>
28.1 --- a/src/share/classes/sun/awt/AWTAccessor.java Thu May 21 18:41:50 2009 +0100
28.2 +++ b/src/share/classes/sun/awt/AWTAccessor.java Tue Jun 09 23:47:38 2009 -0700
28.3 @@ -132,7 +132,7 @@
28.4 /*
28.5 * Update the image of a non-opaque (translucent) window.
28.6 */
28.7 - void updateWindow(Window window, BufferedImage backBuffer);
28.8 + void updateWindow(Window window);
28.9
28.10 /** Get the size of the security warning.
28.11 */
29.1 --- a/src/share/classes/sun/awt/EmbeddedFrame.java Thu May 21 18:41:50 2009 +0100
29.2 +++ b/src/share/classes/sun/awt/EmbeddedFrame.java Tue Jun 09 23:47:38 2009 -0700
29.3 @@ -592,8 +592,9 @@
29.4 public void setOpaque(boolean isOpaque) {
29.5 }
29.6
29.7 - public void updateWindow(BufferedImage bi) {
29.8 + public void updateWindow() {
29.9 }
29.10 +
29.11 public void repositionSecurityWarning() {
29.12 }
29.13 }
30.1 --- a/src/share/classes/sun/awt/HeadlessToolkit.java Thu May 21 18:41:50 2009 +0100
30.2 +++ b/src/share/classes/sun/awt/HeadlessToolkit.java Tue Jun 09 23:47:38 2009 -0700
30.3 @@ -179,9 +179,15 @@
30.4 throw new HeadlessException();
30.5 }
30.6
30.7 - public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager)
30.8 - throws HeadlessException {
30.9 - throw new HeadlessException();
30.10 + public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
30.11 + // See 6833019.
30.12 + return
30.13 + new KeyboardFocusManagerPeer() {
30.14 + public Window getCurrentFocusedWindow() { return null; }
30.15 + public void setCurrentFocusOwner(Component comp) {}
30.16 + public Component getCurrentFocusOwner() { return null; }
30.17 + public void clearGlobalFocusOwner(Window activeWindow) {}
30.18 + };
30.19 }
30.20
30.21 public TrayIconPeer createTrayIcon(TrayIcon target)
31.1 --- a/src/share/classes/sun/awt/NullComponentPeer.java Thu May 21 18:41:50 2009 +0100
31.2 +++ b/src/share/classes/sun/awt/NullComponentPeer.java Tue Jun 09 23:47:38 2009 -0700
31.3 @@ -300,7 +300,9 @@
31.4 public void setZOrder(ComponentPeer above) {
31.5 }
31.6
31.7 - public void updateGraphicsData(GraphicsConfiguration gc) {}
31.8 + public boolean updateGraphicsData(GraphicsConfiguration gc) {
31.9 + return false;
31.10 + }
31.11
31.12 public GraphicsConfiguration getAppropriateGraphicsConfiguration(
31.13 GraphicsConfiguration gc)
32.1 --- a/src/share/classes/sun/awt/SunToolkit.java Thu May 21 18:41:50 2009 +0100
32.2 +++ b/src/share/classes/sun/awt/SunToolkit.java Tue Jun 09 23:47:38 2009 -0700
32.3 @@ -89,6 +89,25 @@
32.4 */
32.5 private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue";
32.6
32.7 + /**
32.8 + * Number of buttons.
32.9 + * By default it's taken from the system. If system value does not
32.10 + * fit into int type range, use our own MAX_BUTTONS_SUPPORT value.
32.11 + */
32.12 + protected static int numberOfButtons = 0;
32.13 +
32.14 +
32.15 + /* XFree standard mention 24 buttons as maximum:
32.16 + * http://www.xfree86.org/current/mouse.4.html
32.17 + * We workaround systems supporting more than 24 buttons.
32.18 + * Otherwise, we have to use long type values as masks
32.19 + * which leads to API change.
32.20 + * InputEvent.BUTTON_DOWN_MASK may contain only 21 masks due to
32.21 + * the 4-bytes limit for the int type. (CR 6799099)
32.22 + * One more bit is reserved for FIRST_HIGH_BIT.
32.23 + */
32.24 + public final static int MAX_BUTTONS_SUPPORTED = 20;
32.25 +
32.26 public SunToolkit() {
32.27 /* If awt.threadgroup is set to class name the instance of
32.28 * this class is created (should be subclass of ThreadGroup)
32.29 @@ -2079,6 +2098,12 @@
32.30 return false;
32.31 }
32.32
32.33 + /**
32.34 + * Descendants of the SunToolkit should override and put their own logic here.
32.35 + */
32.36 + public int getNumberOfButtons(){
32.37 + return 3;
32.38 + }
32.39 } // class SunToolkit
32.40
32.41
33.1 --- a/src/share/classes/sun/awt/shell/ShellFolder.java Thu May 21 18:41:50 2009 +0100
33.2 +++ b/src/share/classes/sun/awt/shell/ShellFolder.java Tue Jun 09 23:47:38 2009 -0700
33.3 @@ -274,45 +274,61 @@
33.4
33.5 // Override File methods
33.6
33.7 - public static void sort(List<? extends File> files) {
33.8 + public static void sort(final List<? extends File> files) {
33.9 if (files == null || files.size() <= 1) {
33.10 return;
33.11 }
33.12
33.13 - // Check that we can use the ShellFolder.sortChildren() method:
33.14 - // 1. All files have the same non-null parent
33.15 - // 2. All files is ShellFolders
33.16 - File commonParent = null;
33.17 + // To avoid loads of synchronizations with Invoker and improve performance we
33.18 + // synchronize the whole code of the sort method once
33.19 + getInvoker().invoke(new Callable<Void>() {
33.20 + public Void call() throws Exception {
33.21 + // Check that we can use the ShellFolder.sortChildren() method:
33.22 + // 1. All files have the same non-null parent
33.23 + // 2. All files is ShellFolders
33.24 + File commonParent = null;
33.25
33.26 - for (File file : files) {
33.27 - File parent = file.getParentFile();
33.28 + for (File file : files) {
33.29 + File parent = file.getParentFile();
33.30
33.31 - if (parent == null || !(file instanceof ShellFolder)) {
33.32 - commonParent = null;
33.33 + if (parent == null || !(file instanceof ShellFolder)) {
33.34 + commonParent = null;
33.35
33.36 - break;
33.37 + break;
33.38 + }
33.39 +
33.40 + if (commonParent == null) {
33.41 + commonParent = parent;
33.42 + } else {
33.43 + if (commonParent != parent && !commonParent.equals(parent)) {
33.44 + commonParent = null;
33.45 +
33.46 + break;
33.47 + }
33.48 + }
33.49 + }
33.50 +
33.51 + if (commonParent instanceof ShellFolder) {
33.52 + ((ShellFolder) commonParent).sortChildren(files);
33.53 + } else {
33.54 + Collections.sort(files, FILE_COMPARATOR);
33.55 + }
33.56 +
33.57 + return null;
33.58 }
33.59 -
33.60 - if (commonParent == null) {
33.61 - commonParent = parent;
33.62 - } else {
33.63 - if (commonParent != parent && !commonParent.equals(parent)) {
33.64 - commonParent = null;
33.65 -
33.66 - break;
33.67 - }
33.68 - }
33.69 - }
33.70 -
33.71 - if (commonParent instanceof ShellFolder) {
33.72 - ((ShellFolder) commonParent).sortChildren(files);
33.73 - } else {
33.74 - Collections.sort(files, FILE_COMPARATOR);
33.75 - }
33.76 + });
33.77 }
33.78
33.79 - public void sortChildren(List<? extends File> files) {
33.80 - Collections.sort(files, FILE_COMPARATOR);
33.81 + public void sortChildren(final List<? extends File> files) {
33.82 + // To avoid loads of synchronizations with Invoker and improve performance we
33.83 + // synchronize the whole code of the sort method once
33.84 + getInvoker().invoke(new Callable<Void>() {
33.85 + public Void call() throws Exception {
33.86 + Collections.sort(files, FILE_COMPARATOR);
33.87 +
33.88 + return null;
33.89 + }
33.90 + });
33.91 }
33.92
33.93 public boolean isAbsolute() {
34.1 --- a/src/share/classes/sun/swing/plaf/GTKKeybindings.java Thu May 21 18:41:50 2009 +0100
34.2 +++ b/src/share/classes/sun/swing/plaf/GTKKeybindings.java Tue Jun 09 23:47:38 2009 -0700
34.3 @@ -402,6 +402,11 @@
34.4 "released SPACE", "released",
34.5 "RETURN", "pressed"
34.6 }),
34.7 + "RootPane.ancestorInputMap",
34.8 + new UIDefaults.LazyInputMap(new Object[]{
34.9 + "shift F10", "postPopup",
34.10 + "CONTEXT_MENU", "postPopup"
34.11 + }),
34.12 // These bindings are only enabled when there is a default
34.13 // button set on the rootpane.
34.14 "RootPane.defaultButtonWindowKeyBindings", new Object[]{
35.1 --- a/src/share/classes/sun/swing/plaf/WindowsKeybindings.java Thu May 21 18:41:50 2009 +0100
35.2 +++ b/src/share/classes/sun/swing/plaf/WindowsKeybindings.java Tue Jun 09 23:47:38 2009 -0700
35.3 @@ -360,6 +360,11 @@
35.4 "DOWN", "decrement",
35.5 "KP_DOWN", "decrement",
35.6 }),
35.7 + "RootPane.ancestorInputMap",
35.8 + new UIDefaults.LazyInputMap(new Object[]{
35.9 + "shift F10", "postPopup",
35.10 + "CONTEXT_MENU", "postPopup"
35.11 + }),
35.12 // These bindings are only enabled when there is a default
35.13 // button set on the rootpane.
35.14 "RootPane.defaultButtonWindowKeyBindings", new Object[]{
36.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames.java Thu May 21 18:41:50 2009 +0100
36.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames.java Tue Jun 09 23:47:38 2009 -0700
36.3 @@ -171,6 +171,8 @@
36.4 "Truk Summer Time", "TRUST"};
36.5 String ULAT[]= new String[] {"Ulaanbaatar Time", "ULAT",
36.6 "Ulaanbaatar Summer Time", "ULAST"};
36.7 + String WART[] = new String[] {"Western Argentine Time", "WART",
36.8 + "Western Argentine Summer Time", "WARST"};
36.9 String WAT[] = new String[] {"Western African Time", "WAT",
36.10 "Western African Summer Time", "WAST"};
36.11 String WET[] = new String[] {"Western European Time", "WET",
36.12 @@ -296,7 +298,7 @@
36.13 {"America/Argentina/Rio_Gallegos", AGT},
36.14 {"America/Argentina/Salta", AGT},
36.15 {"America/Argentina/San_Juan", AGT},
36.16 - {"America/Argentina/San_Luis", AGT},
36.17 + {"America/Argentina/San_Luis", WART},
36.18 {"America/Argentina/Tucuman", AGT},
36.19 {"America/Argentina/Ushuaia", AGT},
36.20 {"America/Aruba", AST},
37.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_de.java Thu May 21 18:41:50 2009 +0100
37.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_de.java Tue Jun 09 23:47:38 2009 -0700
37.3 @@ -171,6 +171,8 @@
37.4 "Truk Sommerzeit", "TRUST"};
37.5 String ULAT[]= new String[] {"Ulaanbaatar Zeit", "ULAT",
37.6 "Ulaanbaatar Sommerzeit", "ULAST"};
37.7 + String WART[] = new String[] {"Argentinische Zeit", "WART",
37.8 + "Argentinische Sommerzeit", "WARST"};
37.9 String WAT[] = new String[] {"Westafrikanische Zeit", "WAT",
37.10 "Westafrikanische Sommerzeit", "WAST"};
37.11 String WET[] = new String[] {"Westeurop\u00e4ische Zeit", "WET",
37.12 @@ -296,7 +298,7 @@
37.13 {"America/Argentina/Rio_Gallegos", AGT},
37.14 {"America/Argentina/Salta", AGT},
37.15 {"America/Argentina/San_Juan", AGT},
37.16 - {"America/Argentina/San_Luis", AGT},
37.17 + {"America/Argentina/San_Luis", WART},
37.18 {"America/Argentina/Tucuman", AGT},
37.19 {"America/Argentina/Ushuaia", AGT},
37.20 {"America/Aruba", AST},
38.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_es.java Thu May 21 18:41:50 2009 +0100
38.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_es.java Tue Jun 09 23:47:38 2009 -0700
38.3 @@ -171,6 +171,8 @@
38.4 "Hora de verano de Truk", "TRUST"};
38.5 String ULAT[]= new String[] {"Hora de Ulan Bator", "ULAT",
38.6 "Hora de verano de Ulan Bator", "ULAST"};
38.7 + String WART[] = new String[] {"Hora de Argentina", "WART",
38.8 + "Hora de verano de Argentina", "WARST"};
38.9 String WAT[] = new String[] {"Hora de \u00c1frica Occidental", "WAT",
38.10 "Hora de verano de \u00c1frica Occidental", "WAST"};
38.11 String WET[] = new String[] {"Hora de Europa Occidental", "WET",
38.12 @@ -296,7 +298,7 @@
38.13 {"America/Argentina/Rio_Gallegos", AGT},
38.14 {"America/Argentina/Salta", AGT},
38.15 {"America/Argentina/San_Juan", AGT},
38.16 - {"America/Argentina/San_Luis", AGT},
38.17 + {"America/Argentina/San_Luis", WART},
38.18 {"America/Argentina/Tucuman", AGT},
38.19 {"America/Argentina/Ushuaia", AGT},
38.20 {"America/Aruba", AST},
39.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_fr.java Thu May 21 18:41:50 2009 +0100
39.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_fr.java Tue Jun 09 23:47:38 2009 -0700
39.3 @@ -171,6 +171,8 @@
39.4 "Heure d'\u00e9t\u00e9 de Truk", "TRUST"};
39.5 String ULAT[]= new String[] {"Heure de l'Ulaanbaatar", "ULAT",
39.6 "Heure d'\u00e9t\u00e9 de l'Ulaanbaatar", "ULAST"} ;
39.7 + String WART[] = new String[] {"Heure D'Argentine", "WART",
39.8 + "Heure d'\u00e9t\u00e9 D'Argentine", "WARST"} ;
39.9 String WAT[] = new String[] {"Heure d'Afrique de l'Ouest", "WAT",
39.10 "Heure d'\u00e9t\u00e9 d'Afrique de l'Ouest", "WAST"} ;
39.11 String WET[] = new String[] {"Heure d'Europe de l'Ouest", "WET",
39.12 @@ -296,7 +298,7 @@
39.13 {"America/Argentina/Rio_Gallegos", AGT},
39.14 {"America/Argentina/Salta", AGT},
39.15 {"America/Argentina/San_Juan", AGT},
39.16 - {"America/Argentina/San_Luis", AGT},
39.17 + {"America/Argentina/San_Luis", WART},
39.18 {"America/Argentina/Tucuman", AGT},
39.19 {"America/Argentina/Ushuaia", AGT},
39.20 {"America/Aruba", AST},
40.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_it.java Thu May 21 18:41:50 2009 +0100
40.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_it.java Tue Jun 09 23:47:38 2009 -0700
40.3 @@ -171,6 +171,8 @@
40.4 "Ora estiva di Truk", "TRUST"};
40.5 String ULAT[]= new String[] {"Ora di Ulaanbaatar", "ULAT",
40.6 "Ora estiva di Ulaanbaatar", "ULAST"};
40.7 + String WART[] = new String[] {"Ora dell'Argentina", "WART",
40.8 + "Ora estiva dell'Argentina", "WARST"};
40.9 String WAT[] = new String[] {"Ora dell'Africa occidentale", "WAT",
40.10 "Ora estiva dell'Africa occidentale", "WAST"};
40.11 String WET[] = new String[] {"Ora dell'Europa occidentale", "WET",
40.12 @@ -296,7 +298,7 @@
40.13 {"America/Argentina/Rio_Gallegos", AGT},
40.14 {"America/Argentina/Salta", AGT},
40.15 {"America/Argentina/San_Juan", AGT},
40.16 - {"America/Argentina/San_Luis", AGT},
40.17 + {"America/Argentina/San_Luis", WART},
40.18 {"America/Argentina/Tucuman", AGT},
40.19 {"America/Argentina/Ushuaia", AGT},
40.20 {"America/Aruba", AST},
41.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_ja.java Thu May 21 18:41:50 2009 +0100
41.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_ja.java Tue Jun 09 23:47:38 2009 -0700
41.3 @@ -171,6 +171,8 @@
41.4 "\u30c8\u30e9\u30c3\u30af\u590f\u6642\u9593", "TRUST"};
41.5 String ULAT[]= new String[] {"\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u6642\u9593", "ULAT",
41.6 "\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u590f\u6642\u9593", "ULAST"};
41.7 + String WART[] = new String[] {"\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "WART",
41.8 + "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u590f\u6642\u9593", "WARST"};
41.9 String WAT[] = new String[] {"\u897f\u30a2\u30d5\u30ea\u30ab\u6642\u9593", "WAT",
41.10 "\u897f\u30a2\u30d5\u30ea\u30ab\u590f\u6642\u9593", "WAST"};
41.11 String WET[] = new String[] {"\u897f\u30e8\u30fc\u30ed\u30c3\u30d1\u6642\u9593", "WET",
41.12 @@ -296,7 +298,7 @@
41.13 {"America/Argentina/Rio_Gallegos", AGT},
41.14 {"America/Argentina/Salta", AGT},
41.15 {"America/Argentina/San_Juan", AGT},
41.16 - {"America/Argentina/San_Luis", AGT},
41.17 + {"America/Argentina/San_Luis", WART},
41.18 {"America/Argentina/Tucuman", AGT},
41.19 {"America/Argentina/Ushuaia", AGT},
41.20 {"America/Aruba", AST},
42.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_ko.java Thu May 21 18:41:50 2009 +0100
42.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_ko.java Tue Jun 09 23:47:38 2009 -0700
42.3 @@ -171,6 +171,8 @@
42.4 "\ud2b8\ub8e8\ud06c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "TRUST"};
42.5 String ULAT[]= new String[] {"\uc6b8\ub780\ubc14\ud0c0\ub974 \uc2dc\uac04", "ULAT",
42.6 "\uc6b8\ub780\ubc14\ud0c0\ub974 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "ULAST"};
42.7 + String WART[] = new String[] {"\uc544\ub974\ud5e8\ud2f0\ub098 \uc2dc\uac04", "WART",
42.8 + "\uc544\ub974\ud5e8\ud2f0\ub098 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WARST"};
42.9 String WAT[] = new String[] {"\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc2dc\uac04", "WAT",
42.10 "\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WAST"};
42.11 String WET[] = new String[] {"\uc11c\uc720\ub7fd \uc2dc\uac04", "WET",
42.12 @@ -296,7 +298,7 @@
42.13 {"America/Argentina/Rio_Gallegos", AGT},
42.14 {"America/Argentina/Salta", AGT},
42.15 {"America/Argentina/San_Juan", AGT},
42.16 - {"America/Argentina/San_Luis", AGT},
42.17 + {"America/Argentina/San_Luis", WART},
42.18 {"America/Argentina/Tucuman", AGT},
42.19 {"America/Argentina/Ushuaia", AGT},
42.20 {"America/Aruba", AST},
43.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_sv.java Thu May 21 18:41:50 2009 +0100
43.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_sv.java Tue Jun 09 23:47:38 2009 -0700
43.3 @@ -171,6 +171,8 @@
43.4 "Truk, sommartid", "TRUST"};
43.5 String ULAT[]= new String[] {"Ulaanbaatar, normaltid", "ULAT",
43.6 "Ulaanbaatar, sommartid", "ULAST"};
43.7 + String WART[] = new String[] {"Argentina, normaltid", "WART",
43.8 + "Argentina, sommartid", "WARST"};
43.9 String WAT[] = new String[] {"V\u00e4stafrikansk tid", "WAT",
43.10 "V\u00e4stafrikansk sommartid", "WAST"};
43.11 String WET[] = new String[] {"V\u00e4steuropeisk tid", "WET",
43.12 @@ -296,7 +298,7 @@
43.13 {"America/Argentina/Rio_Gallegos", AGT},
43.14 {"America/Argentina/Salta", AGT},
43.15 {"America/Argentina/San_Juan", AGT},
43.16 - {"America/Argentina/San_Luis", AGT},
43.17 + {"America/Argentina/San_Luis", WART},
43.18 {"America/Argentina/Tucuman", AGT},
43.19 {"America/Argentina/Ushuaia", AGT},
43.20 {"America/Aruba", AST},
44.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java Thu May 21 18:41:50 2009 +0100
44.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java Tue Jun 09 23:47:38 2009 -0700
44.3 @@ -171,6 +171,8 @@
44.4 "\u7279\u9c81\u514b\u590f\u4ee4\u65f6", "TRUST"};
44.5 String ULAT[]= new String[] {"\u5e93\u4f26\u65f6\u95f4", "ULAT",
44.6 "\u5e93\u4f26\u590f\u4ee4\u65f6", "ULAST"};
44.7 + String WART[] = new String[] {"\u963f\u6839\u5ef7\u65f6\u95f4", "WART",
44.8 + "\u963f\u6839\u5ef7\u590f\u4ee4\u65f6", "WARST"};
44.9 String WAT[] = new String[] {"\u897f\u975e\u65f6\u95f4", "WAT",
44.10 "\u897f\u975e\u590f\u4ee4\u65f6", "WAST"};
44.11 String WET[] = new String[] {"\u897f\u6b27\u65f6\u95f4", "WET",
44.12 @@ -296,7 +298,7 @@
44.13 {"America/Argentina/Rio_Gallegos", AGT},
44.14 {"America/Argentina/Salta", AGT},
44.15 {"America/Argentina/San_Juan", AGT},
44.16 - {"America/Argentina/San_Luis", AGT},
44.17 + {"America/Argentina/San_Luis", WART},
44.18 {"America/Argentina/Tucuman", AGT},
44.19 {"America/Argentina/Ushuaia", AGT},
44.20 {"America/Aruba", AST},
45.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java Thu May 21 18:41:50 2009 +0100
45.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java Tue Jun 09 23:47:38 2009 -0700
45.3 @@ -171,6 +171,8 @@
45.4 "\u7279\u9b6f\u514b\u590f\u4ee4\u6642\u9593", "TRUST"};
45.5 String ULAT[]= new String[] {"\u5eab\u502b\u6642\u9593", "ULAT",
45.6 "\u5eab\u502b\u590f\u4ee4\u6642\u9593", "ULAST"};
45.7 + String WART[] = new String[] {"\u963f\u6839\u5ef7\u6642\u9593", "WART",
45.8 + "\u963f\u6839\u5ef7\u590f\u4ee4\u6642\u9593", "WARST"};
45.9 String WAT[] = new String[] {"\u897f\u975e\u6642\u9593", "WAT",
45.10 "\u897f\u975e\u590f\u4ee4\u6642\u9593", "WAST"};
45.11 String WET[] = new String[] {"\u897f\u6b50\u6642\u9593", "WET",
45.12 @@ -296,7 +298,7 @@
45.13 {"America/Argentina/Rio_Gallegos", AGT},
45.14 {"America/Argentina/Salta", AGT},
45.15 {"America/Argentina/San_Juan", AGT},
45.16 - {"America/Argentina/San_Luis", AGT},
45.17 + {"America/Argentina/San_Luis", WART},
45.18 {"America/Argentina/Tucuman", AGT},
45.19 {"America/Argentina/Ushuaia", AGT},
45.20 {"America/Aruba", AST},
46.1 --- a/src/solaris/classes/sun/awt/X11/MotifDnDConstants.java Thu May 21 18:41:50 2009 +0100
46.2 +++ b/src/solaris/classes/sun/awt/X11/MotifDnDConstants.java Tue Jun 09 23:47:38 2009 -0700
46.3 @@ -120,7 +120,7 @@
46.4 false,
46.5 XConstants.AnyPropertyType);
46.6 try {
46.7 - int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
46.8 + int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
46.9
46.10 if (status == XConstants.Success &&
46.11 wpg.getData() != 0 &&
46.12 @@ -190,7 +190,7 @@
46.13 try {
46.14 Native.putLong(data, motifWindow);
46.15
46.16 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
46.17 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
46.18 XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
46.19 defaultRootWindow,
46.20 XA_MOTIF_DRAG_WINDOW.getAtom(),
46.21 @@ -280,7 +280,7 @@
46.22 false,
46.23 XA_MOTIF_DRAG_TARGETS.getAtom());
46.24 try {
46.25 - int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
46.26 + int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
46.27
46.28 if (status != XConstants.Success
46.29 || wpg.getActualType() != XA_MOTIF_DRAG_TARGETS.getAtom()
46.30 @@ -394,7 +394,7 @@
46.31 }
46.32 }
46.33
46.34 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
46.35 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
46.36 XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
46.37 motifWindow,
46.38 XA_MOTIF_DRAG_TARGETS.getAtom(),
46.39 @@ -410,7 +410,7 @@
46.40 // Create a new motif window and retry.
46.41 motifWindow = createMotifWindow();
46.42
46.43 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
46.44 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
46.45 XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
46.46 motifWindow,
46.47 XA_MOTIF_DRAG_TARGETS.getAtom(),
46.48 @@ -534,7 +534,7 @@
46.49 // CARD32 icc_handle
46.50 unsafe.putInt(structData + 4, (int)XA_MOTIF_ATOM_0.getAtom());
46.51
46.52 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
46.53 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
46.54 XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
46.55 XA_MOTIF_ATOM_0.getAtom(),
46.56 XA_MOTIF_DRAG_INITIATOR_INFO.getAtom(),
46.57 @@ -567,7 +567,7 @@
46.58 unsafe.putShort(data + 10, (short)0); /* pad */
46.59 unsafe.putInt(data + 12, dataSize);
46.60
46.61 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
46.62 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
46.63 XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
46.64 XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
46.65 XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
47.1 --- a/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java Thu May 21 18:41:50 2009 +0100
47.2 +++ b/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java Tue Jun 09 23:47:38 2009 -0700
47.3 @@ -184,7 +184,7 @@
47.4 XConstants.AnyPropertyType);
47.5
47.6 try {
47.7 - int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
47.8 + int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
47.9
47.10 /*
47.11 * DragICCI.h:
48.1 --- a/src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java Thu May 21 18:41:50 2009 +0100
48.2 +++ b/src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java Tue Jun 09 23:47:38 2009 -0700
48.3 @@ -102,7 +102,7 @@
48.4 XConstants.AnyPropertyType);
48.5
48.6 try {
48.7 - status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
48.8 + status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
48.9
48.10 /*
48.11 * DragICCI.h:
48.12 @@ -162,7 +162,7 @@
48.13 unsafe.putInt(data + 12, dataSize);
48.14 }
48.15
48.16 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
48.17 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
48.18 XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
48.19 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
48.20 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
48.21 @@ -204,7 +204,7 @@
48.22 XConstants.AnyPropertyType);
48.23
48.24 try {
48.25 - status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
48.26 + status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
48.27
48.28 /*
48.29 * DragICCI.h:
48.30 @@ -236,7 +236,7 @@
48.31
48.32 unsafe.putInt(data + 4, tproxy);
48.33
48.34 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
48.35 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
48.36 XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
48.37 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
48.38 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
48.39 @@ -276,7 +276,7 @@
48.40 XConstants.AnyPropertyType);
48.41
48.42 try {
48.43 - status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
48.44 + status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
48.45
48.46 /*
48.47 * DragICCI.h:
48.48 @@ -325,7 +325,7 @@
48.49 XConstants.AnyPropertyType);
48.50
48.51 try {
48.52 - int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
48.53 + int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
48.54
48.55 if (status == (int)XConstants.Success && wpg.getData() != 0 &&
48.56 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
48.57 @@ -375,7 +375,7 @@
48.58 MotifDnDConstants.XA_MOTIF_DRAG_INITIATOR_INFO.getAtom());
48.59
48.60 try {
48.61 - int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
48.62 + int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
48.63
48.64 if (status == XConstants.Success && wpg.getData() != 0 &&
48.65 wpg.getActualType() ==
48.66 @@ -412,7 +412,7 @@
48.67 */
48.68 XWindowAttributes wattr = new XWindowAttributes();
48.69 try {
48.70 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
48.71 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
48.72 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
48.73 source_win, wattr.pData);
48.74
48.75 @@ -429,7 +429,7 @@
48.76 wattr.dispose();
48.77 }
48.78
48.79 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
48.80 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
48.81 XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
48.82 source_win_mask |
48.83 XConstants.StructureNotifyMask);
48.84 @@ -1020,7 +1020,7 @@
48.85 if (sourceWindow != 0) {
48.86 XToolkit.awtLock();
48.87 try {
48.88 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
48.89 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
48.90 XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
48.91 sourceWindowMask);
48.92 XToolkit.RESTORE_XERROR_HANDLER();
49.1 --- a/src/solaris/classes/sun/awt/X11/WindowPropertyGetter.java Thu May 21 18:41:50 2009 +0100
49.2 +++ b/src/solaris/classes/sun/awt/X11/WindowPropertyGetter.java Tue Jun 09 23:47:38 2009 -0700
49.3 @@ -75,7 +75,7 @@
49.4 public int execute() {
49.5 return execute(null);
49.6 }
49.7 - public int execute(XToolkit.XErrorHandler errorHandler) {
49.8 + public int execute(XErrorHandler errorHandler) {
49.9
49.10 XToolkit.awtLock();
49.11 try {
49.12 @@ -94,7 +94,7 @@
49.13
49.14 // Fix for performance problem - IgnodeBadWindowHandler is
49.15 // used too much without reason, just ignore it
49.16 - if (errorHandler == XToolkit.IgnoreBadWindowHandler) {
49.17 + if (errorHandler instanceof XErrorHandler.IgnoreBadWindowHandler) {
49.18 errorHandler = null;
49.19 }
49.20
50.1 --- a/src/solaris/classes/sun/awt/X11/XAWTXSettings.java Thu May 21 18:41:50 2009 +0100
50.2 +++ b/src/solaris/classes/sun/awt/X11/XAWTXSettings.java Tue Jun 09 23:47:38 2009 -0700
50.3 @@ -126,7 +126,7 @@
50.4 new WindowPropertyGetter(owner, xSettingsPropertyAtom, 0, MAX_LENGTH,
50.5 false, xSettingsPropertyAtom.getAtom() );
50.6 try {
50.7 - int status = getter.execute(XToolkit.IgnoreBadWindowHandler);
50.8 + int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
50.9
50.10 if (status != XConstants.Success || getter.getData() == 0) {
50.11 if (log.isLoggable(Level.FINE)) log.fine("OH OH : getter failed status = " + status );
51.1 --- a/src/solaris/classes/sun/awt/X11/XBaseWindow.java Thu May 21 18:41:50 2009 +0100
51.2 +++ b/src/solaris/classes/sun/awt/X11/XBaseWindow.java Tue Jun 09 23:47:38 2009 -0700
51.3 @@ -989,8 +989,17 @@
51.4 */
51.5 public void handleButtonPressRelease(XEvent xev) {
51.6 XButtonEvent xbe = xev.get_xbutton();
51.7 + /*
51.8 + * Ignore the buttons above 20 due to the bit limit for
51.9 + * InputEvent.BUTTON_DOWN_MASK.
51.10 + * One more bit is reserved for FIRST_HIGH_BIT.
51.11 + */
51.12 + if (xbe.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
51.13 + return;
51.14 + }
51.15 int buttonState = 0;
51.16 - for (int i = 0; i<XToolkit.getNumMouseButtons(); i++){
51.17 + final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
51.18 + for (int i = 0; i<buttonsNumber; i++){
51.19 // A bug in WM implementation: extra buttons doesn't have state!=0 as they should on Release message.
51.20 if ((i != 4) && (i != 5)){
51.21 buttonState |= (xbe.get_state() & XConstants.buttonsMask[i]);
51.22 @@ -1026,7 +1035,9 @@
51.23 * Checks ButtonRelease released all Mouse buttons
51.24 */
51.25 static boolean isFullRelease(int buttonState, int button) {
51.26 - if (button < 0 || button > XToolkit.getNumMouseButtons()) {
51.27 + final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
51.28 +
51.29 + if (button < 0 || button > buttonsNumber) {
51.30 return buttonState == 0;
51.31 } else {
51.32 return buttonState == XConstants.buttonsMask[button - 1];
52.1 --- a/src/solaris/classes/sun/awt/X11/XComponentPeer.java Thu May 21 18:41:50 2009 +0100
52.2 +++ b/src/solaris/classes/sun/awt/X11/XComponentPeer.java Tue Jun 09 23:47:38 2009 -0700
52.3 @@ -1429,7 +1429,26 @@
52.4 }
52.5 }
52.6
52.7 - public void updateGraphicsData(GraphicsConfiguration gc) {
52.8 + public boolean updateGraphicsData(GraphicsConfiguration gc) {
52.9 + int oldVisual = -1, newVisual = -1;
52.10 +
52.11 + if (graphicsConfig != null) {
52.12 + oldVisual = graphicsConfig.getVisual();
52.13 + }
52.14 + if (gc != null && gc instanceof X11GraphicsConfig) {
52.15 + newVisual = ((X11GraphicsConfig)gc).getVisual();
52.16 + }
52.17 +
52.18 + // If the new visual differs from the old one, the peer must be
52.19 + // recreated because X11 does not allow changing the visual on the fly.
52.20 + // So we even skip the initGraphicsConfiguration() call.
52.21 + // The initial assignment should happen though, hence the != -1 thing.
52.22 + if (oldVisual != -1 && oldVisual != newVisual) {
52.23 + return true;
52.24 + }
52.25 +
52.26 initGraphicsConfiguration();
52.27 + doValidateSurface();
52.28 + return false;
52.29 }
52.30 }
53.1 --- a/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java Thu May 21 18:41:50 2009 +0100
53.2 +++ b/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java Tue Jun 09 23:47:38 2009 -0700
53.3 @@ -1100,7 +1100,8 @@
53.4 }
53.5
53.6 boolean isOverrideRedirect() {
53.7 - return false;
53.8 +// return false;
53.9 + return ((XToolkit)Toolkit.getDefaultToolkit()).isOverrideRedirect((Window)target);
53.10 }
53.11
53.12 public boolean requestWindowFocus(long time, boolean timeProvided) {
54.1 --- a/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java Thu May 21 18:41:50 2009 +0100
54.2 +++ b/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java Tue Jun 09 23:47:38 2009 -0700
54.3 @@ -96,7 +96,7 @@
54.4 action_count++;
54.5 }
54.6
54.7 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
54.8 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
54.9 XDnDConstants.XA_XdndActionList.setAtomData(window,
54.10 XAtom.XA_ATOM,
54.11 data, action_count);
54.12 @@ -117,7 +117,7 @@
54.13 try {
54.14 Native.put(data, formats);
54.15
54.16 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
54.17 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
54.18 XDnDConstants.XA_XdndTypeList.setAtomData(window,
54.19 XAtom.XA_ATOM,
54.20 data, formats.length);
54.21 @@ -195,7 +195,7 @@
54.22 new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1,
54.23 false, XConstants.AnyPropertyType);
54.24
54.25 - int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
54.26 + int status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
54.27
54.28 if (status == XConstants.Success &&
54.29 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
54.30 @@ -215,7 +215,7 @@
54.31 0, 1, false, XAtom.XA_WINDOW);
54.32
54.33 try {
54.34 - status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
54.35 + status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
54.36
54.37 if (status == XConstants.Success &&
54.38 wpg2.getData() != 0 &&
54.39 @@ -233,7 +233,7 @@
54.40 0, 1, false, XAtom.XA_WINDOW);
54.41
54.42 try {
54.43 - status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
54.44 + status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
54.45
54.46 if (status != XConstants.Success ||
54.47 wpg3.getData() == 0 ||
54.48 @@ -249,7 +249,7 @@
54.49 XConstants.AnyPropertyType);
54.50
54.51 try {
54.52 - status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
54.53 + status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
54.54
54.55 if (status != XConstants.Success ||
54.56 wpg4.getData() == 0 ||
55.1 --- a/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java Thu May 21 18:41:50 2009 +0100
55.2 +++ b/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java Tue Jun 09 23:47:38 2009 -0700
55.3 @@ -88,7 +88,7 @@
55.4 try {
55.5 Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION);
55.6
55.7 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
55.8 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
55.9 XDnDConstants.XA_XdndAware.setAtomData(window, XAtom.XA_ATOM, data, 1);
55.10 XToolkit.RESTORE_XERROR_HANDLER();
55.11
55.12 @@ -122,7 +122,7 @@
55.13 false, XConstants.AnyPropertyType);
55.14
55.15 try {
55.16 - status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
55.17 + status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.18
55.19 if (status == XConstants.Success &&
55.20 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
55.21 @@ -141,7 +141,7 @@
55.22 0, 1, false, XAtom.XA_WINDOW);
55.23
55.24 try {
55.25 - status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
55.26 + status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.27
55.28 if (status == XConstants.Success &&
55.29 wpg2.getData() != 0 &&
55.30 @@ -159,7 +159,7 @@
55.31 0, 1, false, XAtom.XA_WINDOW);
55.32
55.33 try {
55.34 - status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
55.35 + status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.36
55.37 if (status != XConstants.Success ||
55.38 wpg3.getData() == 0 ||
55.39 @@ -175,7 +175,7 @@
55.40 XConstants.AnyPropertyType);
55.41
55.42 try {
55.43 - status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
55.44 + status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.45
55.46 if (status != XConstants.Success ||
55.47 wpg4.getData() == 0 ||
55.48 @@ -205,7 +205,7 @@
55.49
55.50 /* The proxy window must have the XdndAware set, as XDnD protocol
55.51 prescribes to check the proxy window for XdndAware. */
55.52 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
55.53 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
55.54 XDnDConstants.XA_XdndAware.setAtomData(newProxy, XAtom.XA_ATOM,
55.55 data, 1);
55.56 XToolkit.RESTORE_XERROR_HANDLER();
55.57 @@ -219,7 +219,7 @@
55.58 Native.putLong(data, 0, newProxy);
55.59
55.60 /* The proxy window must have the XdndProxy set to point to itself.*/
55.61 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
55.62 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
55.63 XDnDConstants.XA_XdndProxy.setAtomData(newProxy, XAtom.XA_WINDOW,
55.64 data, 1);
55.65 XToolkit.RESTORE_XERROR_HANDLER();
55.66 @@ -232,7 +232,7 @@
55.67
55.68 Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION);
55.69
55.70 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
55.71 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
55.72 XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM,
55.73 data, 1);
55.74 XToolkit.RESTORE_XERROR_HANDLER();
55.75 @@ -245,7 +245,7 @@
55.76
55.77 Native.putLong(data, 0, newProxy);
55.78
55.79 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
55.80 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
55.81 XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW,
55.82 data, 1);
55.83 XToolkit.RESTORE_XERROR_HANDLER();
55.84 @@ -278,7 +278,7 @@
55.85 try {
55.86 Native.putLong(data, 0, entry.getVersion());
55.87
55.88 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
55.89 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
55.90 XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM,
55.91 data, 1);
55.92 XToolkit.RESTORE_XERROR_HANDLER();
55.93 @@ -291,7 +291,7 @@
55.94
55.95 Native.putLong(data, 0, (int)entry.getProxy());
55.96
55.97 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
55.98 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
55.99 XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW,
55.100 data, 1);
55.101 XToolkit.RESTORE_XERROR_HANDLER();
55.102 @@ -329,7 +329,7 @@
55.103 false, XConstants.AnyPropertyType);
55.104
55.105 try {
55.106 - status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
55.107 + status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.108
55.109 if (status == XConstants.Success &&
55.110 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
55.111 @@ -348,7 +348,7 @@
55.112 0, 1, false, XAtom.XA_WINDOW);
55.113
55.114 try {
55.115 - status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
55.116 + status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.117
55.118 if (status == XConstants.Success &&
55.119 wpg2.getData() != 0 &&
55.120 @@ -366,7 +366,7 @@
55.121 0, 1, false, XAtom.XA_WINDOW);
55.122
55.123 try {
55.124 - status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
55.125 + status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.126
55.127 if (status != XConstants.Success ||
55.128 wpg3.getData() == 0 ||
55.129 @@ -382,7 +382,7 @@
55.130 XConstants.AnyPropertyType);
55.131
55.132 try {
55.133 - status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
55.134 + status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.135
55.136 if (status != XConstants.Success ||
55.137 wpg4.getData() == 0 ||
55.138 @@ -411,7 +411,7 @@
55.139 false, XConstants.AnyPropertyType);
55.140
55.141 try {
55.142 - int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
55.143 + int status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.144
55.145 if (status == XConstants.Success &&
55.146 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
55.147 @@ -473,7 +473,7 @@
55.148 0, 0xFFFF, false,
55.149 XAtom.XA_ATOM);
55.150 try {
55.151 - wpg.execute(XToolkit.IgnoreBadWindowHandler);
55.152 + wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.153
55.154 if (wpg.getActualType() == XAtom.XA_ATOM &&
55.155 wpg.getActualFormat() == 32) {
55.156 @@ -505,7 +505,7 @@
55.157 0, 0xFFFF, false,
55.158 XAtom.XA_ATOM);
55.159 try {
55.160 - wpg.execute(XToolkit.IgnoreBadWindowHandler);
55.161 + wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.162
55.163 if (wpg.getActualType() == XAtom.XA_ATOM &&
55.164 wpg.getActualFormat() == 32) {
55.165 @@ -541,7 +541,7 @@
55.166 */
55.167 XWindowAttributes wattr = new XWindowAttributes();
55.168 try {
55.169 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
55.170 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.171 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
55.172 source_win, wattr.pData);
55.173
55.174 @@ -558,7 +558,7 @@
55.175 wattr.dispose();
55.176 }
55.177
55.178 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
55.179 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.180 XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
55.181 source_win_mask |
55.182 XConstants.StructureNotifyMask);
55.183 @@ -963,7 +963,7 @@
55.184 if (sourceWindow != 0) {
55.185 XToolkit.awtLock();
55.186 try {
55.187 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
55.188 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.189 XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
55.190 sourceWindowMask);
55.191 XToolkit.RESTORE_XERROR_HANDLER();
55.192 @@ -1104,14 +1104,14 @@
55.193 0, 0xFFFF, false,
55.194 XAtom.XA_ATOM);
55.195 try {
55.196 - wpg.execute(XToolkit.IgnoreBadWindowHandler);
55.197 + wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
55.198
55.199 if (wpg.getActualType() == XAtom.XA_ATOM &&
55.200 wpg.getActualFormat() == 32) {
55.201
55.202 XToolkit.awtLock();
55.203 try {
55.204 - XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
55.205 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
55.206 XDnDConstants.XA_XdndTypeList.setAtomData(xclient.get_window(),
55.207 XAtom.XA_ATOM,
55.208 wpg.getData(),
56.1 --- a/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java Thu May 21 18:41:50 2009 +0100
56.2 +++ b/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java Tue Jun 09 23:47:38 2009 -0700
56.3 @@ -42,6 +42,7 @@
56.4
56.5 import sun.awt.dnd.SunDragSourceContextPeer;
56.6 import sun.awt.dnd.SunDropTargetContextPeer;
56.7 +import sun.awt.SunToolkit;
56.8
56.9 /**
56.10 * The XDragSourceContextPeer class is the class responsible for handling
56.11 @@ -666,6 +667,15 @@
56.12 case XConstants.ButtonRelease: {
56.13 XButtonEvent xbutton = ev.get_xbutton();
56.14 /*
56.15 + * Ignore the buttons above 20 due to the bit limit for
56.16 + * InputEvent.BUTTON_DOWN_MASK.
56.17 + * One more bit is reserved for FIRST_HIGH_BIT.
56.18 + */
56.19 + if (xbutton.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
56.20 + return true;
56.21 + }
56.22 +
56.23 + /*
56.24 * On some X servers it could happen that ButtonRelease coordinates
56.25 * differ from the latest MotionNotify coordinates, so we need to
56.26 * process it as a mouse motion.
57.1 --- a/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java Thu May 21 18:41:50 2009 +0100
57.2 +++ b/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java Tue Jun 09 23:47:38 2009 -0700
57.3 @@ -181,7 +181,7 @@
57.4 long time) {
57.5 XWindowAttributes wattr = new XWindowAttributes();
57.6 try {
57.7 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
57.8 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
57.9 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
57.10 targetWindow, wattr.pData);
57.11
57.12 @@ -198,7 +198,7 @@
57.13 wattr.dispose();
57.14 }
57.15
57.16 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
57.17 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
57.18 XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
57.19 targetWindowMask |
57.20 XConstants.StructureNotifyMask);
57.21 @@ -214,7 +214,7 @@
57.22 }
57.23
57.24 protected final void finalizeDrop() {
57.25 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
57.26 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
57.27 XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
57.28 targetWindowMask);
57.29 XToolkit.RESTORE_XERROR_HANDLER();
58.1 --- a/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java Thu May 21 18:41:50 2009 +0100
58.2 +++ b/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java Tue Jun 09 23:47:38 2009 -0700
58.3 @@ -168,7 +168,7 @@
58.4 if (dest_x >= 0 && dest_y >= 0) {
58.5 XWindowAttributes wattr = new XWindowAttributes();
58.6 try {
58.7 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
58.8 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
58.9 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
58.10 window, wattr.pData);
58.11 XToolkit.RESTORE_XERROR_HANDLER();
58.12 @@ -222,7 +222,7 @@
58.13 long event_mask = 0;
58.14 XWindowAttributes wattr = new XWindowAttributes();
58.15 try {
58.16 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
58.17 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
58.18 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
58.19 embedder, wattr.pData);
58.20 XToolkit.RESTORE_XERROR_HANDLER();
58.21 @@ -240,7 +240,7 @@
58.22 }
58.23
58.24 if ((event_mask & XConstants.PropertyChangeMask) == 0) {
58.25 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
58.26 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
58.27 XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
58.28 event_mask | XConstants.PropertyChangeMask);
58.29 XToolkit.RESTORE_XERROR_HANDLER();
58.30 @@ -394,7 +394,7 @@
58.31
58.32 /* Restore the original event mask for the embedder. */
58.33 if ((event_mask & XConstants.PropertyChangeMask) == 0) {
58.34 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
58.35 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
58.36 XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
58.37 event_mask);
58.38 XToolkit.RESTORE_XERROR_HANDLER();
59.1 --- a/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java Thu May 21 18:41:50 2009 +0100
59.2 +++ b/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java Tue Jun 09 23:47:38 2009 -0700
59.3 @@ -301,7 +301,7 @@
59.4 try {
59.5 XWindowAttributes wattr = new XWindowAttributes();
59.6 try {
59.7 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
59.8 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
59.9 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
59.10 xembed.handle, wattr.pData);
59.11
60.1 --- a/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java Thu May 21 18:41:50 2009 +0100
60.2 +++ b/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java Tue Jun 09 23:47:38 2009 -0700
60.3 @@ -386,5 +386,7 @@
60.4 public void setZOrder(ComponentPeer above) {
60.5 }
60.6
60.7 - public void updateGraphicsData(GraphicsConfiguration gc) {}
60.8 + public boolean updateGraphicsData(GraphicsConfiguration gc) {
60.9 + return false;
60.10 + }
60.11 }
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
61.2 +++ b/src/solaris/classes/sun/awt/X11/XErrorHandler.java Tue Jun 09 23:47:38 2009 -0700
61.3 @@ -0,0 +1,79 @@
61.4 +/*
61.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
61.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
61.7 + *
61.8 + * This code is free software; you can redistribute it and/or modify it
61.9 + * under the terms of the GNU General Public License version 2 only, as
61.10 + * published by the Free Software Foundation. Sun designates this
61.11 + * particular file as subject to the "Classpath" exception as provided
61.12 + * by Sun in the LICENSE file that accompanied this code.
61.13 + *
61.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
61.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
61.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
61.17 + * version 2 for more details (a copy is included in the LICENSE file that
61.18 + * accompanied this code).
61.19 + *
61.20 + * You should have received a copy of the GNU General Public License version
61.21 + * 2 along with this work; if not, write to the Free Software Foundation,
61.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
61.23 + *
61.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
61.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
61.26 + * have any questions.
61.27 + */
61.28 +package sun.awt.X11;
61.29 +
61.30 +public abstract class XErrorHandler {
61.31 +
61.32 + /*
61.33 + * Called under AWT lock
61.34 + */
61.35 + public abstract int handleError(long display, XErrorEvent err);
61.36 +
61.37 + /*
61.38 + * Forwards all the errors to saved error handler (which was
61.39 + * set before XToolkit had been initialized).
61.40 + */
61.41 + public static class XBaseErrorHandler extends XErrorHandler {
61.42 + @Override
61.43 + public int handleError(long display, XErrorEvent err) {
61.44 + return XToolkit.SAVED_ERROR_HANDLER(display, err);
61.45 + }
61.46 + }
61.47 +
61.48 + /*
61.49 + * Instead of validating window id, we simply call XGetWindowProperty,
61.50 + * but temporary install this function as the error handler to ignore
61.51 + * BadWindow error.
61.52 + */
61.53 + public static class IgnoreBadWindowHandler extends XBaseErrorHandler {
61.54 + @Override
61.55 + public int handleError(long display, XErrorEvent err) {
61.56 + if (err.get_error_code() == XConstants.BadWindow) {
61.57 + return 0;
61.58 + }
61.59 + return super.handleError(display, err);
61.60 + }
61.61 + // Shared instance
61.62 + private static IgnoreBadWindowHandler theInstance = new IgnoreBadWindowHandler();
61.63 + public static IgnoreBadWindowHandler getInstance() {
61.64 + return theInstance;
61.65 + }
61.66 + }
61.67 +
61.68 + public static class VerifyChangePropertyHandler extends XBaseErrorHandler {
61.69 + @Override
61.70 + public int handleError(long display, XErrorEvent err) {
61.71 + if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
61.72 + return 0;
61.73 + }
61.74 + return super.handleError(display, err);
61.75 + }
61.76 + // Shared instance
61.77 + private static IgnoreBadWindowHandler theInstance = new IgnoreBadWindowHandler();
61.78 + public static IgnoreBadWindowHandler getInstance() {
61.79 + return theInstance;
61.80 + }
61.81 + }
61.82 +}
62.1 --- a/src/solaris/classes/sun/awt/X11/XKeysym.java Thu May 21 18:41:50 2009 +0100
62.2 +++ b/src/solaris/classes/sun/awt/X11/XKeysym.java Tue Jun 09 23:47:38 2009 -0700
62.3 @@ -29,6 +29,9 @@
62.4 import java.util.Hashtable;
62.5 import sun.misc.Unsafe;
62.6
62.7 +import java.util.logging.Level;
62.8 +import java.util.logging.Logger;
62.9 +
62.10 public class XKeysym {
62.11
62.12 public static void main( String args[] ) {
62.13 @@ -67,6 +70,7 @@
62.14 static Hashtable<Integer, Long> javaKeycode2KeysymHash = new Hashtable<Integer, Long>();
62.15 static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize());
62.16 static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize());
62.17 + private static Logger keyEventLog = Logger.getLogger("sun.awt.X11.kye.XKeysym");
62.18 public static char convertKeysym( long ks, int state ) {
62.19
62.20 /* First check for Latin-1 characters (1:1 mapping) */
62.21 @@ -107,8 +111,15 @@
62.22 // clearly means that caller needs a so called primary keysym.
62.23 mods ^= XConstants.ShiftMask;
62.24 }
62.25 - XlibWrapper.XkbTranslateKeyCode(XToolkit.getXKBKbdDesc(), ev.get_keycode(),
62.26 + long kbdDesc = XToolkit.getXKBKbdDesc();
62.27 + if( kbdDesc != 0 ) {
62.28 + XlibWrapper.XkbTranslateKeyCode(kbdDesc, ev.get_keycode(),
62.29 mods, XlibWrapper.iarg1, XlibWrapper.larg3);
62.30 + }else{
62.31 + // xkb resources already gone
62.32 + keyEventLog.fine("Thread race: Toolkit shutdown before the end of a key event processing.");
62.33 + return 0;
62.34 + }
62.35 //XXX unconsumed modifiers?
62.36 return Native.getLong(XlibWrapper.larg3);
62.37 } finally {
63.1 --- a/src/solaris/classes/sun/awt/X11/XProtocol.java Thu May 21 18:41:50 2009 +0100
63.2 +++ b/src/solaris/classes/sun/awt/X11/XProtocol.java Tue Jun 09 23:47:38 2009 -0700
63.3 @@ -35,20 +35,6 @@
63.4 private Map<XAtom, XAtomList> atomToList = new HashMap<XAtom, XAtomList>();
63.5 private Map<XAtom, Long> atomToAnchor = new HashMap<XAtom, Long>();
63.6
63.7 - /*
63.8 - * Temporary error handler that ensures that we know if
63.9 - * XChangeProperty succeeded or not.
63.10 - */
63.11 - static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() {
63.12 - public int handleError(long display, XErrorEvent err) {
63.13 - XToolkit.XERROR_SAVE(err);
63.14 - if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
63.15 - return 0;
63.16 - } else {
63.17 - return XToolkit.SAVED_ERROR_HANDLER(display, err);
63.18 - }
63.19 - }
63.20 - };
63.21 volatile boolean firstCheck = true;
63.22 /*
63.23 * Check that that the list of protocols specified by WM in property
64.1 --- a/src/solaris/classes/sun/awt/X11/XQueryTree.java Thu May 21 18:41:50 2009 +0100
64.2 +++ b/src/solaris/classes/sun/awt/X11/XQueryTree.java Tue Jun 09 23:47:38 2009 -0700
64.3 @@ -52,7 +52,7 @@
64.4 public int execute() {
64.5 return execute(null);
64.6 }
64.7 - public int execute(XToolkit.XErrorHandler errorHandler) {
64.8 + public int execute(XErrorHandler errorHandler) {
64.9 XToolkit.awtLock();
64.10 try {
64.11 if (isDisposed()) {
65.1 --- a/src/solaris/classes/sun/awt/X11/XRobotPeer.java Thu May 21 18:41:50 2009 +0100
65.2 +++ b/src/solaris/classes/sun/awt/X11/XRobotPeer.java Tue Jun 09 23:47:38 2009 -0700
65.3 @@ -81,16 +81,11 @@
65.4 return pixelArray;
65.5 }
65.6
65.7 - public int getNumberOfButtons(){
65.8 - return getNumberOfButtonsImpl();
65.9 - }
65.10 -
65.11 private static native synchronized void setup();
65.12
65.13 private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y);
65.14 private static native synchronized void mousePressImpl(int buttons);
65.15 private static native synchronized void mouseReleaseImpl(int buttons);
65.16 - private static native synchronized int getNumberOfButtonsImpl();
65.17 private static native synchronized void mouseWheelImpl(int wheelAmt);
65.18
65.19 private static native synchronized void keyPressImpl(int keycode);
66.1 --- a/src/solaris/classes/sun/awt/X11/XToolkit.java Thu May 21 18:41:50 2009 +0100
66.2 +++ b/src/solaris/classes/sun/awt/X11/XToolkit.java Tue Jun 09 23:47:38 2009 -0700
66.3 @@ -85,21 +85,6 @@
66.4 private static boolean areExtraMouseButtonsEnabled = true;
66.5
66.6 /**
66.7 - * Number of buttons.
66.8 - * By default it's taken from the system. If system value does not
66.9 - * fit into int type range, use our own MAX_BUTTONS_SUPPORT value.
66.10 - */
66.11 - private static int numberOfButtons = 0;
66.12 -
66.13 - /* XFree standard mention 24 buttons as maximum:
66.14 - * http://www.xfree86.org/current/mouse.4.html
66.15 - * We workaround systems supporting more than 24 buttons.
66.16 - * Otherwise, we have to use long type values as masks
66.17 - * which leads to API change.
66.18 - */
66.19 - private static int MAX_BUTTONS_SUPPORT = 24;
66.20 -
66.21 - /**
66.22 * True when the x settings have been loaded.
66.23 */
66.24 private boolean loadedXSettings;
66.25 @@ -149,63 +134,78 @@
66.26 setBackingStoreType();
66.27 }
66.28 m_removeSourceEvents = SunToolkit.getMethod(EventQueue.class, "removeSourceEvents", new Class[] {Object.class, Boolean.TYPE}) ;
66.29 +
66.30 + noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler"));
66.31 }
66.32
66.33 - // Error handler stuff
66.34 - static XErrorEvent saved_error;
66.35 - static long saved_error_handler;
66.36 - static XErrorHandler curErrorHandler;
66.37 - // Should be called under LOCK, before releasing LOCK RESTORE_XERROR_HANDLER should be called
66.38 - static void WITH_XERROR_HANDLER(XErrorHandler handler) {
66.39 + //---- ERROR HANDLER CODE ----//
66.40 +
66.41 + /*
66.42 + * Error handler at the moment of XToolkit initialization
66.43 + */
66.44 + private static long saved_error_handler;
66.45 +
66.46 + /*
66.47 + * XErrorEvent being handled
66.48 + */
66.49 + static volatile XErrorEvent saved_error;
66.50 +
66.51 + /*
66.52 + * Current error handler or null if no error handler is set
66.53 + */
66.54 + private static XErrorHandler current_error_handler;
66.55 +
66.56 + /*
66.57 + * Value of sun.awt.noisyerrorhandler system property
66.58 + */
66.59 + private static boolean noisyAwtHandler;
66.60 +
66.61 + public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
66.62 saved_error = null;
66.63 - curErrorHandler = handler;
66.64 - XSync();
66.65 - saved_error_handler = XlibWrapper.SetToolkitErrorHandler();
66.66 + current_error_handler = handler;
66.67 }
66.68 - static void XERROR_SAVE(XErrorEvent event) {
66.69 +
66.70 + public static void RESTORE_XERROR_HANDLER() {
66.71 + current_error_handler = null;
66.72 + }
66.73 +
66.74 + // Should be called under LOCK
66.75 + public static int SAVED_ERROR_HANDLER(long display, XErrorEvent error) {
66.76 + if (saved_error_handler != 0) {
66.77 + // Default XErrorHandler may just terminate the process. Don't call it.
66.78 + // return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
66.79 + }
66.80 + if (log.isLoggable(Level.FINE)) {
66.81 + log.log(Level.FINE, "Unhandled XErrorEvent: " +
66.82 + "id=" + error.get_resourceid() + ", " +
66.83 + "serial=" + error.get_serial() + ", " +
66.84 + "ec=" + error.get_error_code() + ", " +
66.85 + "rc=" + error.get_request_code() + ", " +
66.86 + "mc=" + error.get_minor_code());
66.87 + }
66.88 + return 0;
66.89 + }
66.90 +
66.91 + // Called from the native code when an error occurs
66.92 + private static int globalErrorHandler(long display, long event_ptr) {
66.93 + if (noisyAwtHandler) {
66.94 + XlibWrapper.PrintXErrorEvent(display, event_ptr);
66.95 + }
66.96 + XErrorEvent event = new XErrorEvent(event_ptr);
66.97 saved_error = event;
66.98 - }
66.99 - // Should be called under LOCK
66.100 - static void RESTORE_XERROR_HANDLER() {
66.101 - XSync();
66.102 - XlibWrapper.XSetErrorHandler(saved_error_handler);
66.103 - curErrorHandler = null;
66.104 - }
66.105 - // Should be called under LOCK
66.106 - static int SAVED_ERROR_HANDLER(long display, XErrorEvent error) {
66.107 - return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
66.108 - }
66.109 - interface XErrorHandler {
66.110 - int handleError(long display, XErrorEvent err);
66.111 - }
66.112 - static int GlobalErrorHandler(long display, long event_ptr) {
66.113 - XErrorEvent event = new XErrorEvent(event_ptr);
66.114 try {
66.115 - if (curErrorHandler != null) {
66.116 - return curErrorHandler.handleError(display, event);
66.117 + if (current_error_handler != null) {
66.118 + return current_error_handler.handleError(display, event);
66.119 } else {
66.120 return SAVED_ERROR_HANDLER(display, event);
66.121 }
66.122 - } finally {
66.123 + } catch (Throwable z) {
66.124 + log.log(Level.FINE, "Error in GlobalErrorHandler", z);
66.125 }
66.126 + return 0;
66.127 }
66.128
66.129 -/*
66.130 - * Instead of validating window id, we simply call XGetWindowProperty,
66.131 - * but temporary install this function as the error handler to ignore
66.132 - * BadWindow error.
66.133 - */
66.134 - static XErrorHandler IgnoreBadWindowHandler = new XErrorHandler() {
66.135 - public int handleError(long display, XErrorEvent err) {
66.136 - XERROR_SAVE(err);
66.137 - if (err.get_error_code() == XConstants.BadWindow) {
66.138 - return 0;
66.139 - } else {
66.140 - return SAVED_ERROR_HANDLER(display, err);
66.141 - }
66.142 - }
66.143 - };
66.144 -
66.145 + //---- END OF ERROR HANDLER CODE ----//
66.146
66.147 private native static void initIDs();
66.148 native static void waitForEvents(long nextTaskTime);
66.149 @@ -302,25 +302,34 @@
66.150 areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
66.151 //set system property if not yet assigned
66.152 System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
66.153 +
66.154 + saved_error_handler = XlibWrapper.SetToolkitErrorHandler();
66.155 } finally {
66.156 awtUnlock();
66.157 }
66.158
66.159 Runtime.getRuntime().addShutdownHook(new Thread() {
66.160 - public void run() {
66.161 - XSystemTrayPeer peer = XSystemTrayPeer.getPeerInstance();
66.162 - if (peer != null) {
66.163 - peer.dispose();
66.164 - }
66.165 - if (xs != null) {
66.166 - ((XAWTXSettings)xs).dispose();
66.167 - }
66.168 - freeXKB();
66.169 - if (log.isLoggable(Level.FINE)) {
66.170 - dumpPeers();
66.171 - }
66.172 + public void run() {
66.173 + XSystemTrayPeer peer = XSystemTrayPeer.getPeerInstance();
66.174 + if (peer != null) {
66.175 + peer.dispose();
66.176 }
66.177 - });
66.178 + if (xs != null) {
66.179 + ((XAWTXSettings)xs).dispose();
66.180 + }
66.181 + freeXKB();
66.182 + if (log.isLoggable(Level.FINE)) {
66.183 + dumpPeers();
66.184 + }
66.185 +
66.186 + awtLock();
66.187 + try {
66.188 + XlibWrapper.XSetErrorHandler(saved_error_handler);
66.189 + } finally {
66.190 + awtUnlock();
66.191 + }
66.192 + }
66.193 + });
66.194 }
66.195
66.196 static String getCorrectXIDString(String val) {
66.197 @@ -1434,19 +1443,26 @@
66.198 desktopProperties.put("awt.multiClickInterval",
66.199 Integer.valueOf(getMultiClickTime()));
66.200 desktopProperties.put("awt.mouse.numButtons",
66.201 - Integer.valueOf(getNumMouseButtons()));
66.202 + Integer.valueOf(getNumberOfButtons()));
66.203 }
66.204 }
66.205
66.206 - public static int getNumMouseButtons() {
66.207 + /**
66.208 + * This method runs through the XPointer and XExtendedPointer array.
66.209 + * XExtendedPointer has priority because on some systems XPointer
66.210 + * (which is assigned to the virtual pointer) reports the maximum
66.211 + * capabilities of the mouse pointer (i.e. 32 physical buttons).
66.212 + */
66.213 + private native synchronized int getNumberOfButtonsImpl();
66.214 +
66.215 + @Override
66.216 + public int getNumberOfButtons(){
66.217 awtLock();
66.218 try {
66.219 if (numberOfButtons == 0) {
66.220 - numberOfButtons = Math.min(
66.221 - XlibWrapper.XGetPointerMapping(XToolkit.getDisplay(), 0, 0),
66.222 - MAX_BUTTONS_SUPPORT);
66.223 + numberOfButtons = getNumberOfButtonsImpl();
66.224 }
66.225 - return numberOfButtons;
66.226 + return (numberOfButtons > MAX_BUTTONS_SUPPORTED)? MAX_BUTTONS_SUPPORTED : numberOfButtons;
66.227 } finally {
66.228 awtUnlock();
66.229 }
66.230 @@ -2239,6 +2255,7 @@
66.231 try {
66.232 if (awt_UseXKB_Calls && awt_XKBDescPtr != 0) {
66.233 XlibWrapper.XkbFreeKeyboard(awt_XKBDescPtr, 0xFF, true);
66.234 + awt_XKBDescPtr = 0;
66.235 }
66.236 } finally {
66.237 awtUnlock();
66.238 @@ -2409,8 +2426,6 @@
66.239 return new XDesktopPeer();
66.240 }
66.241
66.242 - public static native void setNoisyXErrorHandler();
66.243 -
66.244 public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
66.245 return areExtraMouseButtonsEnabled;
66.246 }
67.1 --- a/src/solaris/classes/sun/awt/X11/XTranslateCoordinates.java Thu May 21 18:41:50 2009 +0100
67.2 +++ b/src/solaris/classes/sun/awt/X11/XTranslateCoordinates.java Tue Jun 09 23:47:38 2009 -0700
67.3 @@ -57,7 +57,7 @@
67.4 public int execute() {
67.5 return execute(null);
67.6 }
67.7 - public int execute(XToolkit.XErrorHandler errorHandler) {
67.8 + public int execute(XErrorHandler errorHandler) {
67.9 XToolkit.awtLock();
67.10 try {
67.11 if (isDisposed()) {
68.1 --- a/src/solaris/classes/sun/awt/X11/XWM.java Thu May 21 18:41:50 2009 +0100
68.2 +++ b/src/solaris/classes/sun/awt/X11/XWM.java Tue Jun 09 23:47:38 2009 -0700
68.3 @@ -276,7 +276,7 @@
68.4 winmgr_running = false;
68.5 substruct.set_event_mask(XConstants.SubstructureRedirectMask);
68.6
68.7 - XToolkit.WITH_XERROR_HANDLER(DetectWMHandler);
68.8 + XToolkit.WITH_XERROR_HANDLER(detectWMHandler);
68.9 XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
68.10 XToolkit.getDefaultRootWindow(),
68.11 XConstants.CWEventMask,
68.12 @@ -321,7 +321,7 @@
68.13 new WindowPropertyGetter(window, XA_ENLIGHTENMENT_COMMS, 0, 14, false,
68.14 XAtom.XA_STRING);
68.15 try {
68.16 - int status = getter.execute(XToolkit.IgnoreBadWindowHandler);
68.17 + int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
68.18 if (status != XConstants.Success || getter.getData() == 0) {
68.19 return 0;
68.20 }
68.21 @@ -439,7 +439,7 @@
68.22 new WindowPropertyGetter(wmwin, XA_DT_SM_STATE_INFO, 0, 1,
68.23 false, XA_DT_SM_STATE_INFO);
68.24 try {
68.25 - status = getter2.execute(XToolkit.IgnoreBadWindowHandler);
68.26 + status = getter2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
68.27
68.28
68.29 if (status != XConstants.Success || getter2.getData() == 0) {
68.30 @@ -571,21 +571,6 @@
68.31 }
68.32
68.33 /*
68.34 - * Temporary error handler that ensures that we know if
68.35 - * XChangeProperty succeeded or not.
68.36 - */
68.37 - static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() {
68.38 - public int handleError(long display, XErrorEvent err) {
68.39 - XToolkit.XERROR_SAVE(err);
68.40 - if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
68.41 - return 0;
68.42 - } else {
68.43 - return XToolkit.SAVED_ERROR_HANDLER(display, err);
68.44 - }
68.45 - }
68.46 - };
68.47 -
68.48 - /*
68.49 * Prepare IceWM check.
68.50 *
68.51 * The only way to detect IceWM, seems to be by setting
68.52 @@ -617,7 +602,7 @@
68.53
68.54 XToolkit.awtLock();
68.55 try {
68.56 - XToolkit.WITH_XERROR_HANDLER(VerifyChangePropertyHandler);
68.57 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
68.58 XlibWrapper.XChangePropertyS(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
68.59 XA_ICEWM_WINOPTHINT.getAtom(),
68.60 XA_ICEWM_WINOPTHINT.getAtom(),
68.61 @@ -682,20 +667,19 @@
68.62 * Temporary error handler that checks if selecting for
68.63 * SubstructureRedirect failed.
68.64 */
68.65 - static boolean winmgr_running = false;
68.66 - static XToolkit.XErrorHandler DetectWMHandler = new XToolkit.XErrorHandler() {
68.67 - public int handleError(long display, XErrorEvent err) {
68.68 - XToolkit.XERROR_SAVE(err);
68.69 - if (err.get_request_code() == XProtocolConstants.X_ChangeWindowAttributes
68.70 - && err.get_error_code() == XConstants.BadAccess)
68.71 - {
68.72 - winmgr_running = true;
68.73 - return 0;
68.74 - } else {
68.75 - return XToolkit.SAVED_ERROR_HANDLER(display, err);
68.76 - }
68.77 + private static boolean winmgr_running = false;
68.78 + private static XErrorHandler detectWMHandler = new XErrorHandler.XBaseErrorHandler() {
68.79 + @Override
68.80 + public int handleError(long display, XErrorEvent err) {
68.81 + if ((err.get_request_code() == XProtocolConstants.X_ChangeWindowAttributes) &&
68.82 + (err.get_error_code() == XConstants.BadAccess))
68.83 + {
68.84 + winmgr_running = true;
68.85 + return 0;
68.86 }
68.87 - };
68.88 + return super.handleError(display, err);
68.89 + }
68.90 + };
68.91
68.92 /*
68.93 * Make an educated guess about running window manager.
69.1 --- a/src/solaris/classes/sun/awt/X11/XWarningWindow.java Thu May 21 18:41:50 2009 +0100
69.2 +++ b/src/solaris/classes/sun/awt/X11/XWarningWindow.java Tue Jun 09 23:47:38 2009 -0700
69.3 @@ -34,74 +34,68 @@
69.4 import sun.awt.SunToolkit;
69.5
69.6 class XWarningWindow extends XWindow {
69.7 - private final static int showingDelay = 330;
69.8 - private final static int hidingDelay = 2000;
69.9 + private final static int SHOWING_DELAY = 330;
69.10 + private final static int HIDING_DELAY = 2000;
69.11
69.12 private final Window ownerWindow;
69.13 private WeakReference<XWindowPeer> ownerPeer;
69.14 -
69.15 - public final Window getOwnerWindow() {
69.16 - return ownerWindow;
69.17 - }
69.18 private long parentWindow;
69.19
69.20 private final static String OWNER = "OWNER";
69.21 -
69.22 - private static XIconInfo[][] icons;
69.23 -
69.24 private InfoWindow.Tooltip tooltip;
69.25
69.26 - private static synchronized XIconInfo getSecurityIconInfo(int size, int num) {
69.27 - if (icons == null) {
69.28 - icons = new XIconInfo[4][3];
69.29 - if (XlibWrapper.dataModel == 32) {
69.30 - icons[0][0] = new XIconInfo(XAWTIcon32_security_icon_bw16_png.security_icon_bw16_png);
69.31 - icons[0][1] = new XIconInfo(XAWTIcon32_security_icon_interim16_png.security_icon_interim16_png);
69.32 - icons[0][2] = new XIconInfo(XAWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png);
69.33 - icons[1][0] = new XIconInfo(XAWTIcon32_security_icon_bw24_png.security_icon_bw24_png);
69.34 - icons[1][1] = new XIconInfo(XAWTIcon32_security_icon_interim24_png.security_icon_interim24_png);
69.35 - icons[1][2] = new XIconInfo(XAWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png);
69.36 - icons[2][0] = new XIconInfo(XAWTIcon32_security_icon_bw32_png.security_icon_bw32_png);
69.37 - icons[2][1] = new XIconInfo(XAWTIcon32_security_icon_interim32_png.security_icon_interim32_png);
69.38 - icons[2][2] = new XIconInfo(XAWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png);
69.39 - icons[3][0] = new XIconInfo(XAWTIcon32_security_icon_bw48_png.security_icon_bw48_png);
69.40 - icons[3][1] = new XIconInfo(XAWTIcon32_security_icon_interim48_png.security_icon_interim48_png);
69.41 - icons[3][2] = new XIconInfo(XAWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png);
69.42 - } else {
69.43 - icons[0][0] = new XIconInfo(XAWTIcon64_security_icon_bw16_png.security_icon_bw16_png);
69.44 - icons[0][1] = new XIconInfo(XAWTIcon64_security_icon_interim16_png.security_icon_interim16_png);
69.45 - icons[0][2] = new XIconInfo(XAWTIcon64_security_icon_yellow16_png.security_icon_yellow16_png);
69.46 - icons[1][0] = new XIconInfo(XAWTIcon64_security_icon_bw24_png.security_icon_bw24_png);
69.47 - icons[1][1] = new XIconInfo(XAWTIcon64_security_icon_interim24_png.security_icon_interim24_png);
69.48 - icons[1][2] = new XIconInfo(XAWTIcon64_security_icon_yellow24_png.security_icon_yellow24_png);
69.49 - icons[2][0] = new XIconInfo(XAWTIcon64_security_icon_bw32_png.security_icon_bw32_png);
69.50 - icons[2][1] = new XIconInfo(XAWTIcon64_security_icon_interim32_png.security_icon_interim32_png);
69.51 - icons[2][2] = new XIconInfo(XAWTIcon64_security_icon_yellow32_png.security_icon_yellow32_png);
69.52 - icons[3][0] = new XIconInfo(XAWTIcon64_security_icon_bw48_png.security_icon_bw48_png);
69.53 - icons[3][1] = new XIconInfo(XAWTIcon64_security_icon_interim48_png.security_icon_interim48_png);
69.54 - icons[3][2] = new XIconInfo(XAWTIcon64_security_icon_yellow48_png.security_icon_yellow48_png);
69.55 + /**
69.56 + * Animation stage.
69.57 + */
69.58 + private volatile int currentIcon = 0;
69.59 +
69.60 + /* -1 - uninitialized.
69.61 + * 0 - 16x16
69.62 + * 1 - 24x24
69.63 + * 2 - 32x32
69.64 + * 3 - 48x48
69.65 + */
69.66 + private int currentSize = -1;
69.67 + private static XIconInfo[][] icons;
69.68 + private static XIconInfo getSecurityIconInfo(int size, int num) {
69.69 + synchronized (XWarningWindow.class) {
69.70 + if (icons == null) {
69.71 + icons = new XIconInfo[4][3];
69.72 + if (XlibWrapper.dataModel == 32) {
69.73 + icons[0][0] = new XIconInfo(XAWTIcon32_security_icon_bw16_png.security_icon_bw16_png);
69.74 + icons[0][1] = new XIconInfo(XAWTIcon32_security_icon_interim16_png.security_icon_interim16_png);
69.75 + icons[0][2] = new XIconInfo(XAWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png);
69.76 + icons[1][0] = new XIconInfo(XAWTIcon32_security_icon_bw24_png.security_icon_bw24_png);
69.77 + icons[1][1] = new XIconInfo(XAWTIcon32_security_icon_interim24_png.security_icon_interim24_png);
69.78 + icons[1][2] = new XIconInfo(XAWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png);
69.79 + icons[2][0] = new XIconInfo(XAWTIcon32_security_icon_bw32_png.security_icon_bw32_png);
69.80 + icons[2][1] = new XIconInfo(XAWTIcon32_security_icon_interim32_png.security_icon_interim32_png);
69.81 + icons[2][2] = new XIconInfo(XAWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png);
69.82 + icons[3][0] = new XIconInfo(XAWTIcon32_security_icon_bw48_png.security_icon_bw48_png);
69.83 + icons[3][1] = new XIconInfo(XAWTIcon32_security_icon_interim48_png.security_icon_interim48_png);
69.84 + icons[3][2] = new XIconInfo(XAWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png);
69.85 + } else {
69.86 + icons[0][0] = new XIconInfo(XAWTIcon64_security_icon_bw16_png.security_icon_bw16_png);
69.87 + icons[0][1] = new XIconInfo(XAWTIcon64_security_icon_interim16_png.security_icon_interim16_png);
69.88 + icons[0][2] = new XIconInfo(XAWTIcon64_security_icon_yellow16_png.security_icon_yellow16_png);
69.89 + icons[1][0] = new XIconInfo(XAWTIcon64_security_icon_bw24_png.security_icon_bw24_png);
69.90 + icons[1][1] = new XIconInfo(XAWTIcon64_security_icon_interim24_png.security_icon_interim24_png);
69.91 + icons[1][2] = new XIconInfo(XAWTIcon64_security_icon_yellow24_png.security_icon_yellow24_png);
69.92 + icons[2][0] = new XIconInfo(XAWTIcon64_security_icon_bw32_png.security_icon_bw32_png);
69.93 + icons[2][1] = new XIconInfo(XAWTIcon64_security_icon_interim32_png.security_icon_interim32_png);
69.94 + icons[2][2] = new XIconInfo(XAWTIcon64_security_icon_yellow32_png.security_icon_yellow32_png);
69.95 + icons[3][0] = new XIconInfo(XAWTIcon64_security_icon_bw48_png.security_icon_bw48_png);
69.96 + icons[3][1] = new XIconInfo(XAWTIcon64_security_icon_interim48_png.security_icon_interim48_png);
69.97 + icons[3][2] = new XIconInfo(XAWTIcon64_security_icon_yellow48_png.security_icon_yellow48_png);
69.98 + }
69.99 }
69.100 }
69.101 final int sizeIndex = size % icons.length;
69.102 return icons[sizeIndex][num % icons[sizeIndex].length];
69.103 }
69.104
69.105 - private volatile int currentIcon = 0;
69.106 -
69.107 - /* -1 - uninitialized yet
69.108 - * 0 - 16x16
69.109 - * 1 - 24x24
69.110 - * 2 - 32x32
69.111 - * 3 - 48x48
69.112 - */
69.113 - private volatile int currentSize = -1;
69.114 -
69.115 - /** Indicates whether the shape of the window must be updated
69.116 - */
69.117 - private volatile boolean sizeUpdated = true;
69.118 -
69.119 - private synchronized boolean updateIconSize() {
69.120 - int newSize = currentSize;
69.121 + private void updateIconSize() {
69.122 + int newSize = -1;
69.123
69.124 if (ownerWindow != null) {
69.125 Insets insets = ownerWindow.getInsets();
69.126 @@ -117,14 +111,32 @@
69.127 newSize = 3;
69.128 }
69.129 }
69.130 - if (newSize != currentSize) {
69.131 - currentSize = newSize;
69.132 - sizeUpdated = true;
69.133 + // Make sure we have a valid size
69.134 + if (newSize == -1) {
69.135 + newSize = 0;
69.136 }
69.137 - return sizeUpdated;
69.138 +
69.139 + // Note: this is not the most wise solution to use awtLock here,
69.140 + // this should have been sync'ed with the stateLock. However,
69.141 + // the awtLock must be taken first (see XBaseWindow.getStateLock()),
69.142 + // and we need the awtLock anyway to update the shape of the icon.
69.143 + // So it's easier to use just one lock instead.
69.144 + XToolkit.awtLock();
69.145 + try {
69.146 + if (newSize != currentSize) {
69.147 + currentSize = newSize;
69.148 + XIconInfo ico = getSecurityIconInfo(currentSize, 0);
69.149 + XlibWrapper.SetBitmapShape(XToolkit.getDisplay(), getWindow(),
69.150 + ico.getWidth(), ico.getHeight(), ico.getIntData());
69.151 + AWTAccessor.getWindowAccessor().setSecurityWarningSize(
69.152 + ownerWindow, ico.getWidth(), ico.getHeight());
69.153 + }
69.154 + } finally {
69.155 + XToolkit.awtUnlock();
69.156 + }
69.157 }
69.158
69.159 - private synchronized XIconInfo getSecurityIconInfo() {
69.160 + private XIconInfo getSecurityIconInfo() {
69.161 updateIconSize();
69.162 return getSecurityIconInfo(currentSize, currentIcon);
69.163 }
69.164 @@ -183,28 +195,6 @@
69.165 }
69.166 }
69.167
69.168 - private void updateWarningWindowBounds() {
69.169 - XWindowPeer peer = ownerPeer.get();
69.170 - if (peer != null) {
69.171 - synchronized (this) {
69.172 - if (updateIconSize()) {
69.173 - XIconInfo ico = getSecurityIconInfo();
69.174 - XToolkit.awtLock();
69.175 - try {
69.176 - XlibWrapper.SetBitmapShape(XToolkit.getDisplay(), getWindow(),
69.177 - ico.getWidth(), ico.getHeight(), ico.getIntData());
69.178 - } finally {
69.179 - XToolkit.awtUnlock();
69.180 - }
69.181 - sizeUpdated = false;
69.182 - AWTAccessor.getWindowAccessor().setSecurityWarningSize(
69.183 - ownerWindow, ico.getWidth(), ico.getHeight());
69.184 - }
69.185 - }
69.186 - peer.repositionSecurityWarning();
69.187 - }
69.188 - }
69.189 -
69.190 /**
69.191 * @param x,y,w,h coordinates of the untrusted window
69.192 */
69.193 @@ -376,25 +366,22 @@
69.194
69.195 private final Runnable showingTask = new Runnable() {
69.196 public void run() {
69.197 - new Thread() {
69.198 - public void run() {
69.199 - if (!isVisible()) {
69.200 - xSetVisible(true);
69.201 - updateWarningWindowBounds();
69.202 - }
69.203 - repaint();
69.204 - if (currentIcon > 0) {
69.205 - currentIcon--;
69.206 - XToolkit.schedule(showingTask, showingDelay);
69.207 - }
69.208 - }}.start();
69.209 + if (!isVisible()) {
69.210 + xSetVisible(true);
69.211 + updateIconSize();
69.212 + XWindowPeer peer = ownerPeer.get();
69.213 + if (peer != null) {
69.214 + peer.repositionSecurityWarning();
69.215 + }
69.216 + }
69.217 + repaint();
69.218 + if (currentIcon > 0) {
69.219 + currentIcon--;
69.220 + XToolkit.schedule(showingTask, SHOWING_DELAY);
69.221 + }
69.222 }
69.223 };
69.224
69.225 - public void setSecurityWarningVisible(boolean visible) {
69.226 - setSecurityWarningVisible(visible, true);
69.227 - }
69.228 -
69.229 public void setSecurityWarningVisible(boolean visible, boolean doSchedule) {
69.230 if (visible) {
69.231 XToolkit.remove(hidingTask);
69.232 @@ -416,7 +403,7 @@
69.233 return;
69.234 }
69.235 if (doSchedule) {
69.236 - XToolkit.schedule(hidingTask, hidingDelay);
69.237 + XToolkit.schedule(hidingTask, HIDING_DELAY);
69.238 } else {
69.239 hidingTask.run();
69.240 }
70.1 --- a/src/solaris/classes/sun/awt/X11/XWindow.java Thu May 21 18:41:50 2009 +0100
70.2 +++ b/src/solaris/classes/sun/awt/X11/XWindow.java Tue Jun 09 23:47:38 2009 -0700
70.3 @@ -677,6 +677,14 @@
70.4 int button=0;
70.5 boolean wheel_mouse = false;
70.6 int lbutton = xbe.get_button();
70.7 + /*
70.8 + * Ignore the buttons above 20 due to the bit limit for
70.9 + * InputEvent.BUTTON_DOWN_MASK.
70.10 + * One more bit is reserved for FIRST_HIGH_BIT.
70.11 + */
70.12 + if (lbutton > SunToolkit.MAX_BUTTONS_SUPPORTED) {
70.13 + return;
70.14 + }
70.15 int type = xev.get_type();
70.16 when = xbe.get_time();
70.17 long jWhen = XToolkit.nowMillisUTC_offset(when);
70.18 @@ -795,8 +803,9 @@
70.19 //this doesn't work for extra buttons because Xsystem is sending state==0 for every extra button event.
70.20 // we can't correct it in MouseEvent class as we done it with modifiers, because exact type (DRAG|MOVE)
70.21 // should be passed from XWindow.
70.22 - //TODO: eliminate it with some other value obtained w/o AWTLock.
70.23 - for (int i = 0; i < XToolkit.getNumMouseButtons(); i++){
70.24 + final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
70.25 +
70.26 + for (int i = 0; i < buttonsNumber; i++){
70.27 // TODO : here is the bug in WM: extra buttons doesn't have state!=0 as they should.
70.28 if ((i != 4) && (i != 5)) {
70.29 mouseKeyState = mouseKeyState | (xme.get_state() & XConstants.buttonsMask[i]);
70.30 @@ -1343,18 +1352,23 @@
70.31 setSizeHints(flags, x, y, width, height);
70.32 }
70.33
70.34 - void validateSurface() {
70.35 + void validateSurface() {
70.36 if ((width != oldWidth) || (height != oldHeight)) {
70.37 - SurfaceData oldData = surfaceData;
70.38 - if (oldData != null) {
70.39 - surfaceData = graphicsConfig.createSurfaceData(this);
70.40 - oldData.invalidate();
70.41 - }
70.42 + doValidateSurface();
70.43 +
70.44 oldWidth = width;
70.45 oldHeight = height;
70.46 }
70.47 }
70.48
70.49 + final void doValidateSurface() {
70.50 + SurfaceData oldData = surfaceData;
70.51 + if (oldData != null) {
70.52 + surfaceData = graphicsConfig.createSurfaceData(this);
70.53 + oldData.invalidate();
70.54 + }
70.55 + }
70.56 +
70.57 public SurfaceData getSurfaceData() {
70.58 return surfaceData;
70.59 }
71.1 --- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java Thu May 21 18:41:50 2009 +0100
71.2 +++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java Tue Jun 09 23:47:38 2009 -0700
71.3 @@ -1108,7 +1108,7 @@
71.4 }
71.5 }
71.6
71.7 - warningWindow.setSecurityWarningVisible(show);
71.8 + warningWindow.setSecurityWarningVisible(show, true);
71.9 }
71.10
71.11 boolean isOverrideRedirect() {
71.12 @@ -1894,7 +1894,9 @@
71.13 }
71.14 if (isGrabbed()) {
71.15 boolean dragging = false;
71.16 - for (int i = 0; i<XToolkit.getNumMouseButtons(); i++){
71.17 + final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
71.18 +
71.19 + for (int i = 0; i < buttonsNumber; i++){
71.20 // here is the bug in WM: extra buttons doesn't have state!=0 as they should.
71.21 if ((i != 4) && (i != 5)){
71.22 dragging = dragging || ((xme.get_state() & XConstants.buttonsMask[i]) != 0);
71.23 @@ -1940,6 +1942,15 @@
71.24
71.25 public void handleButtonPressRelease(XEvent xev) {
71.26 XButtonEvent xbe = xev.get_xbutton();
71.27 +
71.28 + /*
71.29 + * Ignore the buttons above 20 due to the bit limit for
71.30 + * InputEvent.BUTTON_DOWN_MASK.
71.31 + * One more bit is reserved for FIRST_HIGH_BIT.
71.32 + */
71.33 + if (xbe.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
71.34 + return;
71.35 + }
71.36 if (grabLog.isLoggable(Level.FINE)) {
71.37 grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2} ({3}, {4}, {5}x{6})",
71.38 new Object[] {xbe, isGrabbed(), containsGlobal(xbe.get_x_root(), xbe.get_y_root()), getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()});
71.39 @@ -2058,7 +2069,7 @@
71.40 }
71.41
71.42 @Override
71.43 - public void updateWindow(BufferedImage backBuffer) {
71.44 + public void updateWindow() {
71.45 // no-op
71.46 }
71.47 }
72.1 --- a/src/solaris/classes/sun/awt/X11/XlibUtil.java Thu May 21 18:41:50 2009 +0100
72.2 +++ b/src/solaris/classes/sun/awt/X11/XlibUtil.java Tue Jun 09 23:47:38 2009 -0700
72.3 @@ -149,7 +149,7 @@
72.4 new XTranslateCoordinates(src, dst, p.x, p.y);
72.5 try
72.6 {
72.7 - int status = xtc.execute(XToolkit.IgnoreBadWindowHandler);
72.8 + int status = xtc.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
72.9 if ((status != 0) &&
72.10 ((XToolkit.saved_error == null) ||
72.11 (XToolkit.saved_error.get_error_code() == XConstants.Success)))
72.12 @@ -306,7 +306,7 @@
72.13 XWM.XA_WM_STATE);
72.14 try
72.15 {
72.16 - wpg.execute(XToolkit.IgnoreBadWindowHandler);
72.17 + wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
72.18 if (wpg.getActualType() == XWM.XA_WM_STATE.getAtom())
72.19 {
72.20 return true;
72.21 @@ -345,7 +345,7 @@
72.22 XWindowAttributes wattr = new XWindowAttributes();
72.23 try
72.24 {
72.25 - XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
72.26 + XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
72.27 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
72.28 window, wattr.pData);
72.29 XToolkit.RESTORE_XERROR_HANDLER();
73.1 --- a/src/solaris/classes/sun/awt/X11/XlibWrapper.java Thu May 21 18:41:50 2009 +0100
73.2 +++ b/src/solaris/classes/sun/awt/X11/XlibWrapper.java Tue Jun 09 23:47:38 2009 -0700
73.3 @@ -646,4 +646,6 @@
73.4 String javaVersion = XToolkit.getSystemProperty("java.version");
73.5 return javaVersion != null && javaVersion.contains("internal");
73.6 }
73.7 +
73.8 + static native void PrintXErrorEvent(long display, long event_ptr);
73.9 }
74.1 --- a/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386 Thu May 21 18:41:50 2009 +0100
74.2 +++ b/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386 Tue Jun 09 23:47:38 2009 -0700
74.3 @@ -186,6 +186,15 @@
74.4 XEvent.xkeymap 0
74.5 XEvent.pad 0
74.6 XEvent 192
74.7 +XRenderDirectFormat.red 0
74.8 +XRenderDirectFormat.redMask 2
74.9 +XRenderDirectFormat.green 4
74.10 +XRenderDirectFormat.greenMask 6
74.11 +XRenderDirectFormat.blue 8
74.12 +XRenderDirectFormat.blueMask 10
74.13 +XRenderDirectFormat.alpha 12
74.14 +XRenderDirectFormat.alphaMask 14
74.15 +XRenderDirectFormat 16
74.16 ColorData.awt_Colors 0
74.17 ColorData.awt_numICMcolors 8
74.18 ColorData.awt_icmLUT 16
74.19 @@ -440,6 +449,12 @@
74.20 XSetWindowAttributes.colormap 96
74.21 XSetWindowAttributes.cursor 104
74.22 XSetWindowAttributes 112
74.23 +XRenderPictFormat.id 0
74.24 +XRenderPictFormat.type 8
74.25 +XRenderPictFormat.depth 12
74.26 +XRenderPictFormat.direct 16
74.27 +XRenderPictFormat.colormap 32
74.28 +XRenderPictFormat 40
74.29 XReparentEvent.type 0
74.30 XReparentEvent.serial 8
74.31 XReparentEvent.send_event 16
74.32 @@ -985,7 +1000,8 @@
74.33 AwtGraphicsConfigData.color_data 144
74.34 AwtGraphicsConfigData.glxInfo 152
74.35 AwtGraphicsConfigData.isTranslucencySupported 160
74.36 -AwtGraphicsConfigData 168
74.37 +AwtGraphicsConfigData.renderPictFormat 168
74.38 +AwtGraphicsConfigData 208
74.39 XColor.pixel 0
74.40 XColor.red 8
74.41 XColor.green 10
75.1 --- a/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt Thu May 21 18:41:50 2009 +0100
75.2 +++ b/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt Tue Jun 09 23:47:38 2009 -0700
75.3 @@ -245,6 +245,21 @@
75.4 blue_mask long
75.5 colormap_size int
75.6 bits_per_rgb int
75.7 +XRenderDirectFormat
75.8 + red short
75.9 + redMask short
75.10 + green short
75.11 + greenMask short
75.12 + blue short
75.13 + blueMask short
75.14 + alpha short
75.15 + alphaMask short
75.16 +XRenderPictFormat
75.17 + id long
75.18 + type int
75.19 + depth int
75.20 + direct struct XRenderDirectFormat
75.21 + colormap long
75.22 XIMHotKeyTrigger
75.23 keysym long
75.24 modifier int
75.25 @@ -751,6 +766,7 @@
75.26 color_data pointer ColorData
75.27 glxInfo pointer
75.28 isTranslucencySupported int
75.29 + renderPictFormat struct XRenderPictFormat
75.30
75.31 AwtScreenData
75.32 numConfigs int
76.1 --- a/src/solaris/classes/sun/awt/X11/keysym2ucs.h Thu May 21 18:41:50 2009 +0100
76.2 +++ b/src/solaris/classes/sun/awt/X11/keysym2ucs.h Tue Jun 09 23:47:38 2009 -0700
76.3 @@ -67,6 +67,9 @@
76.4 tojava import java.util.Hashtable;
76.5 tojava import sun.misc.Unsafe;
76.6 tojava
76.7 +tojava import java.util.logging.Level;
76.8 +tojava import java.util.logging.Logger;
76.9 +tojava
76.10 tojava public class XKeysym {
76.11 tojava
76.12 tojava public static void main( String args[] ) {
76.13 @@ -105,6 +108,7 @@
76.14 tojava static Hashtable<Integer, Long> javaKeycode2KeysymHash = new Hashtable<Integer, Long>();
76.15 tojava static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize());
76.16 tojava static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize());
76.17 +tojava private static Logger keyEventLog = Logger.getLogger("sun.awt.X11.kye.XKeysym");
76.18 tojava public static char convertKeysym( long ks, int state ) {
76.19 tojava
76.20 tojava /* First check for Latin-1 characters (1:1 mapping) */
76.21 @@ -145,8 +149,15 @@
76.22 tojava // clearly means that caller needs a so called primary keysym.
76.23 tojava mods ^= XConstants.ShiftMask;
76.24 tojava }
76.25 -tojava XlibWrapper.XkbTranslateKeyCode(XToolkit.getXKBKbdDesc(), ev.get_keycode(),
76.26 +tojava long kbdDesc = XToolkit.getXKBKbdDesc();
76.27 +tojava if( kbdDesc != 0 ) {
76.28 +tojava XlibWrapper.XkbTranslateKeyCode(kbdDesc, ev.get_keycode(),
76.29 tojava mods, XlibWrapper.iarg1, XlibWrapper.larg3);
76.30 +tojava }else{
76.31 +tojava // xkb resources already gone
76.32 +tojava keyEventLog.fine("Thread race: Toolkit shutdown before the end of a key event processing.");
76.33 +tojava return 0;
76.34 +tojava }
76.35 tojava //XXX unconsumed modifiers?
76.36 tojava return Native.getLong(XlibWrapper.larg3);
76.37 tojava } finally {
77.1 --- a/src/solaris/classes/sun/awt/X11GraphicsConfig.java Thu May 21 18:41:50 2009 +0100
77.2 +++ b/src/solaris/classes/sun/awt/X11GraphicsConfig.java Tue Jun 09 23:47:38 2009 -0700
77.3 @@ -37,7 +37,10 @@
77.4 import java.awt.Transparency;
77.5 import java.awt.image.BufferedImage;
77.6 import java.awt.image.ColorModel;
77.7 +import java.awt.color.ColorSpace;
77.8 +import java.awt.image.ComponentColorModel;
77.9 import java.awt.image.DirectColorModel;
77.10 +import java.awt.image.DataBuffer;
77.11 import java.awt.image.VolatileImage;
77.12 import java.awt.image.WritableRaster;
77.13 import java.awt.geom.AffineTransform;
77.14 @@ -230,6 +233,22 @@
77.15 }
77.16 }
77.17
77.18 + public static DirectColorModel createDCM32(int rMask, int gMask, int bMask,
77.19 + int aMask, boolean aPre) {
77.20 + return new DirectColorModel(
77.21 + ColorSpace.getInstance(ColorSpace.CS_sRGB),
77.22 + 32, rMask, gMask, bMask, aMask, aPre, DataBuffer.TYPE_INT);
77.23 + }
77.24 +
77.25 + public static ComponentColorModel createABGRCCM() {
77.26 + ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
77.27 + int[] nBits = {8, 8, 8, 8};
77.28 + int[] bOffs = {3, 2, 1, 0};
77.29 + return new ComponentColorModel(cs, nBits, true, true,
77.30 + Transparency.TRANSLUCENT,
77.31 + DataBuffer.TYPE_BYTE);
77.32 + }
77.33 +
77.34 /**
77.35 * Returns the default Transform for this configuration. This
77.36 * Transform is typically the Identity transform for most normal
78.1 --- a/src/solaris/classes/sun/awt/motif/MToolkit.java Thu May 21 18:41:50 2009 +0100
78.2 +++ b/src/solaris/classes/sun/awt/motif/MToolkit.java Tue Jun 09 23:47:38 2009 -0700
78.3 @@ -1,5 +1,5 @@
78.4 /*
78.5 - * Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved.
78.6 + * Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
78.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
78.8 *
78.9 * This code is free software; you can redistribute it and/or modify it
78.10 @@ -624,7 +624,6 @@
78.11 }
78.12
78.13 private native int getMulticlickTime();
78.14 - private native int getNumMouseButtons();
78.15
78.16 protected void initializeDesktopProperties() {
78.17 desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50));
78.18 @@ -643,7 +642,7 @@
78.19 desktopProperties.put("awt.multiClickInterval",
78.20 Integer.valueOf(getMulticlickTime()));
78.21 desktopProperties.put("awt.mouse.numButtons",
78.22 - Integer.valueOf(getNumMouseButtons()));
78.23 + Integer.valueOf(getNumberOfButtons()));
78.24 }
78.25 }
78.26
79.1 --- a/src/solaris/classes/sun/java2d/x11/X11PMBlitBgLoops.java Thu May 21 18:41:50 2009 +0100
79.2 +++ b/src/solaris/classes/sun/java2d/x11/X11PMBlitBgLoops.java Tue Jun 09 23:47:38 2009 -0700
79.3 @@ -70,6 +70,10 @@
79.4 X11SurfaceData.UShort565RgbX11),
79.5 new X11PMBlitBgLoops(X11SurfaceData.UShortIndexedX11_BM,
79.6 X11SurfaceData.UShortIndexedX11),
79.7 + new X11PMBlitBgLoops(X11SurfaceData.IntRgbX11_BM,
79.8 + X11SurfaceData.IntArgbPreX11),
79.9 + new X11PMBlitBgLoops(X11SurfaceData.IntBgrX11_BM,
79.10 + X11SurfaceData.FourByteAbgrPreX11),
79.11 };
79.12 GraphicsPrimitiveMgr.register(primitives);
79.13 }
80.1 --- a/src/solaris/classes/sun/java2d/x11/X11PMBlitLoops.java Thu May 21 18:41:50 2009 +0100
80.2 +++ b/src/solaris/classes/sun/java2d/x11/X11PMBlitLoops.java Tue Jun 09 23:47:38 2009 -0700
80.3 @@ -95,6 +95,22 @@
80.4 new X11PMBlitLoops(X11SurfaceData.UShortIndexedX11_BM,
80.5 X11SurfaceData.UShortIndexedX11, true),
80.6
80.7 + new X11PMBlitLoops(X11SurfaceData.IntRgbX11,
80.8 + X11SurfaceData.IntArgbPreX11, true),
80.9 + new X11PMBlitLoops(X11SurfaceData.IntRgbX11,
80.10 + X11SurfaceData.IntArgbPreX11, false),
80.11 + new X11PMBlitLoops(X11SurfaceData.IntRgbX11_BM,
80.12 + X11SurfaceData.IntArgbPreX11, true),
80.13 +
80.14 + new X11PMBlitLoops(X11SurfaceData.IntBgrX11,
80.15 + X11SurfaceData.FourByteAbgrPreX11, true),
80.16 + new X11PMBlitLoops(X11SurfaceData.IntBgrX11,
80.17 + X11SurfaceData.FourByteAbgrPreX11, false),
80.18 + new X11PMBlitLoops(X11SurfaceData.IntBgrX11_BM,
80.19 + X11SurfaceData.FourByteAbgrPreX11, true),
80.20 +
80.21 +
80.22 +
80.23 // delegate loops
80.24 new DelegateBlitLoop(X11SurfaceData.IntBgrX11_BM,
80.25 X11SurfaceData.IntBgrX11),
81.1 --- a/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java Thu May 21 18:41:50 2009 +0100
81.2 +++ b/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java Tue Jun 09 23:47:38 2009 -0700
81.3 @@ -81,6 +81,13 @@
81.4 DESC_INT_BGR_X11 = "Integer BGR Pixmap";
81.5 public static final String
81.6 DESC_INT_RGB_X11 = "Integer RGB Pixmap";
81.7 +
81.8 + public static final String
81.9 + DESC_4BYTE_ABGR_PRE_X11 = "4 byte ABGR Pixmap with pre-multplied alpha";
81.10 + public static final String
81.11 + DESC_INT_ARGB_PRE_X11 = "Integer ARGB Pixmap with pre-multiplied " +
81.12 + "alpha";
81.13 +
81.14 public static final String
81.15 DESC_BYTE_IND_OPQ_X11 = "Byte Indexed Opaque Pixmap";
81.16
81.17 @@ -133,6 +140,11 @@
81.18 public static final SurfaceType IntRgbX11 =
81.19 SurfaceType.IntRgb.deriveSubType(DESC_INT_RGB_X11);
81.20
81.21 + public static final SurfaceType FourByteAbgrPreX11 =
81.22 + SurfaceType.FourByteAbgrPre.deriveSubType(DESC_4BYTE_ABGR_PRE_X11);
81.23 + public static final SurfaceType IntArgbPreX11 =
81.24 + SurfaceType.IntArgbPre.deriveSubType(DESC_INT_ARGB_PRE_X11);
81.25 +
81.26 public static final SurfaceType ThreeByteRgbX11 =
81.27 SurfaceType.ThreeByteRgb.deriveSubType(DESC_3BYTE_RGB_X11);
81.28 public static final SurfaceType ThreeByteBgrX11 =
81.29 @@ -413,7 +425,7 @@
81.30 int transparency)
81.31 {
81.32 return new X11PixmapSurfaceData(gc, width, height, image,
81.33 - getSurfaceType(gc, transparency),
81.34 + getSurfaceType(gc, transparency, true),
81.35 cm, drawable, transparency);
81.36 }
81.37
81.38 @@ -498,6 +510,13 @@
81.39 public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
81.40 int transparency)
81.41 {
81.42 + return getSurfaceType(gc, transparency, false);
81.43 + }
81.44 +
81.45 + public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
81.46 + int transparency,
81.47 + boolean pixmapSurface)
81.48 + {
81.49 boolean transparent = (transparency == Transparency.BITMASK);
81.50 SurfaceType sType;
81.51 ColorModel cm = gc.getColorModel();
81.52 @@ -524,11 +543,21 @@
81.53 // Fall through for 32 bit case
81.54 case 32:
81.55 if (cm instanceof DirectColorModel) {
81.56 - if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
81.57 - sType = transparent ? X11SurfaceData.IntRgbX11_BM : X11SurfaceData.IntRgbX11;
81.58 + if (((SunToolkit)java.awt.Toolkit.getDefaultToolkit()
81.59 + ).isTranslucencyCapable(gc) && !pixmapSurface)
81.60 + {
81.61 + sType = X11SurfaceData.IntArgbPreX11;
81.62 } else {
81.63 - sType = transparent ? X11SurfaceData.IntBgrX11_BM : X11SurfaceData.IntBgrX11;
81.64 + if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
81.65 + sType = transparent ? X11SurfaceData.IntRgbX11_BM :
81.66 + X11SurfaceData.IntRgbX11;
81.67 + } else {
81.68 + sType = transparent ? X11SurfaceData.IntBgrX11_BM :
81.69 + X11SurfaceData.IntBgrX11;
81.70 + }
81.71 }
81.72 + } else if (cm instanceof ComponentColorModel) {
81.73 + sType = X11SurfaceData.FourByteAbgrPreX11;
81.74 } else {
81.75
81.76 throw new sun.java2d.InvalidPipeException("Unsupported bit " +
82.1 --- a/src/solaris/native/sun/awt/X11Color.c Thu May 21 18:41:50 2009 +0100
82.2 +++ b/src/solaris/native/sun/awt/X11Color.c Tue Jun 09 23:47:38 2009 -0700
82.3 @@ -886,6 +886,27 @@
82.4 #define blue(v) (((v) >> 0) & 0xFF)
82.5
82.6 #ifndef HEADLESS
82.7 +
82.8 +jobject getColorSpace(JNIEnv* env, jint csID) {
82.9 + jclass clazz;
82.10 + jobject cspaceL;
82.11 + jmethodID mid;
82.12 +
82.13 + clazz = (*env)->FindClass(env,"java/awt/color/ColorSpace");
82.14 + mid = (*env)->GetStaticMethodID(env, clazz, "getInstance",
82.15 + "(I)Ljava/awt/color/ColorSpace;");
82.16 + if (mid == NULL) {
82.17 + return NULL;
82.18 + }
82.19 +
82.20 + /* SECURITY: This is safe, because static methods cannot
82.21 + * be overridden, and this method does not invoke
82.22 + * client code
82.23 + */
82.24 +
82.25 + return (*env)->CallStaticObjectMethod(env, clazz, mid, csID);
82.26 +}
82.27 +
82.28 jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData)
82.29 {
82.30 jobject awt_colormodel = NULL;
82.31 @@ -899,21 +920,61 @@
82.32 (aData->awt_depth >= 15))
82.33 {
82.34 clazz = (*env)->FindClass(env,"java/awt/image/DirectColorModel");
82.35 + if (!aData->isTranslucencySupported) {
82.36
82.37 - mid = (*env)->GetMethodID(env,clazz,"<init>","(IIIII)V");
82.38 + mid = (*env)->GetMethodID(env,clazz,"<init>","(IIIII)V");
82.39
82.40 - if (mid == NULL) {
82.41 - (*env)->PopLocalFrame(env, 0);
82.42 - return NULL;
82.43 + if (mid == NULL) {
82.44 + (*env)->PopLocalFrame(env, 0);
82.45 + return NULL;
82.46 + }
82.47 + awt_colormodel = (*env)->NewObject(env,clazz, mid,
82.48 + aData->awt_visInfo.depth,
82.49 + aData->awt_visInfo.red_mask,
82.50 + aData->awt_visInfo.green_mask,
82.51 + aData->awt_visInfo.blue_mask,
82.52 + 0);
82.53 + } else {
82.54 + clazz = (*env)->FindClass(env,"sun/awt/X11GraphicsConfig");
82.55 + if (clazz == NULL) {
82.56 + (*env)->PopLocalFrame(env, 0);
82.57 + return NULL;
82.58 + }
82.59 +
82.60 + if (aData->renderPictFormat.direct.red == 16) {
82.61 + mid = (*env)->GetStaticMethodID( env,clazz,"createDCM32",
82.62 + "(IIIIZ)Ljava/awt/image/DirectColorModel;");
82.63 +
82.64 + if (mid == NULL) {
82.65 + (*env)->PopLocalFrame(env, 0);
82.66 + return NULL;
82.67 + }
82.68 +
82.69 + awt_colormodel = (*env)->CallStaticObjectMethod(
82.70 + env,clazz, mid,
82.71 + aData->renderPictFormat.direct.redMask
82.72 + << aData->renderPictFormat.direct.red,
82.73 + aData->renderPictFormat.direct.greenMask
82.74 + << aData->renderPictFormat.direct.green,
82.75 + aData->renderPictFormat.direct.blueMask
82.76 + << aData->renderPictFormat.direct.blue,
82.77 + aData->renderPictFormat.direct.alphaMask
82.78 + << aData->renderPictFormat.direct.alpha,
82.79 + JNI_TRUE);
82.80 + } else {
82.81 + mid = (*env)->GetStaticMethodID( env,clazz,"createABGRCCM",
82.82 + "()Ljava/awt/image/ComponentColorModel;");
82.83 +
82.84 + if (mid == NULL) {
82.85 + (*env)->PopLocalFrame(env, 0);
82.86 + return NULL;
82.87 + }
82.88 +
82.89 + awt_colormodel = (*env)->CallStaticObjectMethod(
82.90 + env,clazz, mid);
82.91 + }
82.92 }
82.93
82.94 - awt_colormodel = (*env)->NewObject(env,clazz, mid,
82.95 - aData->awt_visInfo.depth,
82.96 - aData->awt_visInfo.red_mask,
82.97 - aData->awt_visInfo.green_mask,
82.98 - aData->awt_visInfo.blue_mask,
82.99 - 0);
82.100 -
82.101 if(awt_colormodel == NULL)
82.102 {
82.103 (*env)->PopLocalFrame(env, 0);
82.104 @@ -923,25 +984,13 @@
82.105 }
82.106 else if (aData->awt_visInfo.class == StaticGray &&
82.107 aData->awt_num_colors == 256) {
82.108 - jclass clazz1;
82.109 jobject cspace = NULL;
82.110 jint bits[1];
82.111 jintArray bitsArray;
82.112 jboolean falseboolean = JNI_FALSE;
82.113
82.114 - clazz1 = (*env)->FindClass(env,"java/awt/color/ColorSpace");
82.115 - mid = (*env)->GetStaticMethodID(env, clazz1, "getInstance",
82.116 - "(I)Ljava/awt/color/ColorSpace;");
82.117 - if (mid == NULL) {
82.118 - (*env)->PopLocalFrame(env, 0);
82.119 - return NULL;
82.120 - }
82.121 - /* SECURITY: This is safe, because static methods cannot
82.122 - * be overridden, and this method does not invoke
82.123 - * client code
82.124 - */
82.125 - cspace = (*env)->CallStaticObjectMethod(env, clazz1, mid,
82.126 - java_awt_color_ColorSpace_CS_GRAY);
82.127 + cspace = getColorSpace(env, java_awt_color_ColorSpace_CS_GRAY);
82.128 +
82.129 if (cspace == NULL) {
82.130 (*env)->PopLocalFrame(env, 0);
82.131 return NULL;
83.1 --- a/src/solaris/native/sun/awt/awt_GraphicsEnv.c Thu May 21 18:41:50 2009 +0100
83.2 +++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.c Tue Jun 09 23:47:38 2009 -0700
83.3 @@ -175,42 +175,11 @@
83.4 }
83.5
83.6 #ifndef HEADLESS
83.7 +
83.8 /*
83.9 - * error handlers
83.10 + * XIOErrorHandler
83.11 */
83.12 -
83.13 -int
83.14 -xerror_handler(Display * disp, XErrorEvent * err)
83.15 -{
83.16 -/* #ifdef DEBUG */
83.17 - char msg[128];
83.18 - char buf[128];
83.19 - char *ev = getenv("NOISY_AWT");
83.20 -
83.21 - if (!ev || !ev[0])
83.22 - return 0;
83.23 - XGetErrorText(disp, err->error_code, msg, sizeof(msg));
83.24 - jio_fprintf(stderr, "Xerror %s, XID %x, ser# %d\n", msg, err->resourceid, err->serial);
83.25 - jio_snprintf(buf, sizeof(buf), "%d", err->request_code);
83.26 - XGetErrorDatabaseText(disp, "XRequest", buf, "Unknown", msg, sizeof(msg));
83.27 - jio_fprintf(stderr, "Major opcode %d (%s)\n", err->request_code, msg);
83.28 - if (err->request_code > 128) {
83.29 - jio_fprintf(stderr, "Minor opcode %d\n", err->minor_code);
83.30 - }
83.31 - if (awtLockInited) {
83.32 - /*SignalError(lockedee->lastpc, lockedee, "fp/ade/gui/GUIException", msg); */
83.33 - }
83.34 - if (strcasecmp(ev, "abort") == 0) {
83.35 - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
83.36 -
83.37 - (*env)->FatalError(env, "xerror_handler abort");
83.38 - }
83.39 -/* #endif */
83.40 - return 0;
83.41 -}
83.42 -
83.43 -static int
83.44 -xioerror_handler(Display * disp)
83.45 +static int xioerror_handler(Display *disp)
83.46 {
83.47 if (awtLockInited) {
83.48 if (errno == EPIPE) {
83.49 @@ -354,48 +323,6 @@
83.50 return NULL;
83.51 }
83.52
83.53 -/* Note: until we include the <X11/extensions/Xrender.h> explicitly
83.54 - * we have to define a couple of things ourselves.
83.55 - */
83.56 -typedef unsigned long PictFormat;
83.57 -#define PictTypeIndexed 0
83.58 -#define PictTypeDirect 1
83.59 -
83.60 -typedef struct {
83.61 - short red;
83.62 - short redMask;
83.63 - short green;
83.64 - short greenMask;
83.65 - short blue;
83.66 - short blueMask;
83.67 - short alpha;
83.68 - short alphaMask;
83.69 -} XRenderDirectFormat;
83.70 -
83.71 -typedef struct {
83.72 - PictFormat id;
83.73 - int type;
83.74 - int depth;
83.75 - XRenderDirectFormat direct;
83.76 - Colormap colormap;
83.77 -} XRenderPictFormat;
83.78 -
83.79 -#define PictFormatID (1 << 0)
83.80 -#define PictFormatType (1 << 1)
83.81 -#define PictFormatDepth (1 << 2)
83.82 -#define PictFormatRed (1 << 3)
83.83 -#define PictFormatRedMask (1 << 4)
83.84 -#define PictFormatGreen (1 << 5)
83.85 -#define PictFormatGreenMask (1 << 6)
83.86 -#define PictFormatBlue (1 << 7)
83.87 -#define PictFormatBlueMask (1 << 8)
83.88 -#define PictFormatAlpha (1 << 9)
83.89 -#define PictFormatAlphaMask (1 << 10)
83.90 -#define PictFormatColormap (1 << 11)
83.91 -
83.92 -typedef XRenderPictFormat *
83.93 -XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
83.94 -
83.95 static void
83.96 getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
83.97
83.98 @@ -535,6 +462,8 @@
83.99 format->direct.alphaMask)
83.100 {
83.101 graphicsConfigs [ind]->isTranslucencySupported = 1;
83.102 + memcpy(&graphicsConfigs [ind]->renderPictFormat, format,
83.103 + sizeof(*format));
83.104 }
83.105 }
83.106 }
83.107 @@ -886,7 +815,6 @@
83.108 return NULL;
83.109 }
83.110
83.111 - XSetErrorHandler(xerror_handler);
83.112 XSetIOErrorHandler(xioerror_handler);
83.113
83.114 /* set awt_numScreens, and whether or not we're using Xinerama */
84.1 --- a/src/solaris/native/sun/awt/awt_InputMethod.c Thu May 21 18:41:50 2009 +0100
84.2 +++ b/src/solaris/native/sun/awt/awt_InputMethod.c Tue Jun 09 23:47:38 2009 -0700
84.3 @@ -1458,7 +1458,6 @@
84.4 }
84.5
84.6 static void OpenXIMCallback(Display *display, XPointer client_data, XPointer call_data) {
84.7 - extern int xerror_handler();
84.8 XIMCallback ximCallback;
84.9
84.10 X11im = XOpenIM(display, NULL, NULL, NULL);
84.11 @@ -1469,13 +1468,6 @@
84.12 ximCallback.callback = (XIMProc)DestroyXIMCallback;
84.13 ximCallback.client_data = NULL;
84.14 XSetIMValues(X11im, XNDestroyCallback, &ximCallback, NULL);
84.15 -
84.16 - /* Workaround for Solaris 2.6 bug 4097754. We're affected by this problem
84.17 - * because Motif also calls XOpenIM for us. Re-registering the error handler
84.18 - * that MToolkit has registered already after calling XOpenIM avoids the
84.19 - * problem.
84.20 - */
84.21 - XSetErrorHandler(xerror_handler);
84.22 }
84.23
84.24 static void DestroyXIMCallback(XIM im, XPointer client_data, XPointer call_data) {
85.1 --- a/src/solaris/native/sun/awt/awt_MToolkit.c Thu May 21 18:41:50 2009 +0100
85.2 +++ b/src/solaris/native/sun/awt/awt_MToolkit.c Tue Jun 09 23:47:38 2009 -0700
85.3 @@ -1926,26 +1926,6 @@
85.4 XtAppProcessEvent(awt_appContext, iMask & ~XtIMXEvent);
85.5 }
85.6
85.7 - /*
85.8 - ** Bug #4361799: Forte4J sometimes crashes on Solaris:
85.9 - ** There is an underlying bug in Selection.c in Xt lib.
85.10 - ** The routine HandleSelectionEvents, can call EndProtectedSection()
85.11 - ** more than StartProtectedSection(), and then EndProtectedSection
85.12 - ** will restore the default XError handler. As a result awt's
85.13 - ** XError handler gets removed and we later crash on an XError.
85.14 - **
85.15 - ** This happens when we call XtAppProcessEvent with event type 1e
85.16 - ** (SelectionRequest) when running two copies of Forte
85.17 - **
85.18 - ** XSetErrorHandler can safely be called repeatedly, so we are
85.19 - ** fixing this with the sledgehammer, and resetting our XError
85.20 - ** handler every time through the loop:
85.21 - */
85.22 - {
85.23 - extern int32_t xerror_handler();
85.24 - XSetErrorHandler(xerror_handler);
85.25 - }
85.26 -
85.27 } /* processOneEvent() */
85.28
85.29 /*
85.30 @@ -3188,21 +3168,6 @@
85.31
85.32 /*
85.33 * Class: sun_awt_motif_MToolkit
85.34 - * Method: getNumMouseButtons
85.35 - * Signature: ()I
85.36 - */
85.37 -JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getNumMouseButtons
85.38 - (JNIEnv *env, jobject this)
85.39 -{
85.40 - jint res = 0;
85.41 - AWT_LOCK();
85.42 - res = XGetPointerMapping(awt_display, NULL, 0);
85.43 - AWT_UNLOCK();
85.44 - return res;
85.45 -}
85.46 -
85.47 -/*
85.48 - * Class: sun_awt_motif_MToolkit
85.49 * Method: loadXSettings
85.50 * Signature: ()V
85.51 */
86.1 --- a/src/solaris/native/sun/awt/awt_Robot.c Thu May 21 18:41:50 2009 +0100
86.2 +++ b/src/solaris/native/sun/awt/awt_Robot.c Tue Jun 09 23:47:38 2009 -0700
86.3 @@ -51,9 +51,8 @@
86.4
86.5 extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
86.6
86.7 -// 2 would be more correct, however that's how Robot originally worked
86.8 -// and tests start to fail if this value is changed
86.9 -static int32_t num_buttons = 3;
86.10 +extern int32_t getNumButtons();
86.11 +
86.12 static jint * masks;
86.13
86.14 static int32_t isXTestAvailable() {
86.15 @@ -90,46 +89,6 @@
86.16 return isXTestAvailable;
86.17 }
86.18
86.19 -static void getNumButtons() {
86.20 - int32_t major_opcode, first_event, first_error;
86.21 - int32_t xinputAvailable;
86.22 - int32_t numDevices, devIdx, clsIdx;
86.23 - XDeviceInfo* devices;
86.24 - XDeviceInfo* aDevice;
86.25 - XButtonInfo* bInfo;
86.26 -
86.27 - /* 4700242:
86.28 - * If XTest is asked to press a non-existant mouse button
86.29 - * (i.e. press Button3 on a system configured with a 2-button mouse),
86.30 - * then a crash may happen. To avoid this, we use the XInput
86.31 - * extension to query for the number of buttons on the XPointer, and check
86.32 - * before calling XTestFakeButtonEvent().
86.33 - */
86.34 - xinputAvailable = XQueryExtension(awt_display, INAME, &major_opcode, &first_event, &first_error);
86.35 - DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XINPUT) returns major_opcode = %d, first_event = %d, first_error = %d",
86.36 - major_opcode, first_event, first_error);
86.37 - if (xinputAvailable) {
86.38 - devices = XListInputDevices(awt_display, &numDevices);
86.39 - for (devIdx = 0; devIdx < numDevices; devIdx++) {
86.40 - aDevice = &(devices[devIdx]);
86.41 - if (aDevice->use == IsXPointer) {
86.42 - for (clsIdx = 0; clsIdx < aDevice->num_classes; clsIdx++) {
86.43 - if (aDevice->inputclassinfo[clsIdx].class == ButtonClass) {
86.44 - bInfo = (XButtonInfo*)(&(aDevice->inputclassinfo[clsIdx]));
86.45 - num_buttons = bInfo->num_buttons;
86.46 - DTRACE_PRINTLN1("RobotPeer: XPointer has %d buttons", num_buttons);
86.47 - break;
86.48 - }
86.49 - }
86.50 - break;
86.51 - }
86.52 - }
86.53 - XFreeDeviceList(devices);
86.54 - }
86.55 - else {
86.56 - DTRACE_PRINTLN1("RobotPeer: XINPUT extension is unavailable, assuming %d mouse buttons", num_buttons);
86.57 - }
86.58 -}
86.59
86.60 static XImage *getWindowImage(Display * display, Window window,
86.61 int32_t x, int32_t y,
86.62 @@ -241,17 +200,10 @@
86.63 return;
86.64 }
86.65
86.66 - getNumButtons();
86.67 finally:
86.68 AWT_UNLOCK();
86.69 }
86.70
86.71 -JNIEXPORT jint JNICALL
86.72 -Java_sun_awt_X11_XRobotPeer_getNumberOfButtonsImpl(JNIEnv *env,
86.73 - jclass cls) {
86.74 - // At the moment this routine being called we already should have an initialized num_buttons variable.
86.75 - return num_buttons;
86.76 -}
86.77
86.78 JNIEXPORT void JNICALL
86.79 Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
86.80 @@ -386,6 +338,8 @@
86.81 {
86.82 AWT_LOCK();
86.83
86.84 + int32_t num_buttons = getNumButtons(); //from XToolkit.c
86.85 +
86.86 DTRACE_PRINTLN1("RobotPeer: mouseAction(%i)", buttonMask);
86.87 DTRACE_PRINTLN1("RobotPeer: mouseAction, press = %d", isMousePress);
86.88
87.1 --- a/src/solaris/native/sun/awt/awt_p.h Thu May 21 18:41:50 2009 +0100
87.2 +++ b/src/solaris/native/sun/awt/awt_p.h Tue Jun 09 23:47:38 2009 -0700
87.3 @@ -119,6 +119,50 @@
87.4 } DamageRect;
87.5
87.6 #ifndef HEADLESS
87.7 +
87.8 +/* Note: until we include the <X11/extensions/Xrender.h> explicitly
87.9 + * we have to define a couple of things ourselves.
87.10 + */
87.11 +typedef unsigned long PictFormat;
87.12 +#define PictTypeIndexed 0
87.13 +#define PictTypeDirect 1
87.14 +
87.15 +typedef struct {
87.16 + short red;
87.17 + short redMask;
87.18 + short green;
87.19 + short greenMask;
87.20 + short blue;
87.21 + short blueMask;
87.22 + short alpha;
87.23 + short alphaMask;
87.24 +} XRenderDirectFormat;
87.25 +
87.26 +typedef struct {
87.27 + PictFormat id;
87.28 + int type;
87.29 + int depth;
87.30 + XRenderDirectFormat direct;
87.31 + Colormap colormap;
87.32 +} XRenderPictFormat;
87.33 +
87.34 +#define PictFormatID (1 << 0)
87.35 +#define PictFormatType (1 << 1)
87.36 +#define PictFormatDepth (1 << 2)
87.37 +#define PictFormatRed (1 << 3)
87.38 +#define PictFormatRedMask (1 << 4)
87.39 +#define PictFormatGreen (1 << 5)
87.40 +#define PictFormatGreenMask (1 << 6)
87.41 +#define PictFormatBlue (1 << 7)
87.42 +#define PictFormatBlueMask (1 << 8)
87.43 +#define PictFormatAlpha (1 << 9)
87.44 +#define PictFormatAlphaMask (1 << 10)
87.45 +#define PictFormatColormap (1 << 11)
87.46 +
87.47 +typedef XRenderPictFormat *
87.48 +XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
87.49 +/* END OF Xrender.h chunk */
87.50 +
87.51 typedef struct _AwtGraphicsConfigData {
87.52 int awt_depth;
87.53 Colormap awt_cmap;
87.54 @@ -136,6 +180,7 @@
87.55 ColorData *color_data;
87.56 struct _GLXGraphicsConfigInfo *glxInfo;
87.57 int isTranslucencySupported; /* Uses Xrender to find this out. */
87.58 + XRenderPictFormat renderPictFormat; /*Used only if translucency supported*/
87.59 } AwtGraphicsConfigData;
87.60
87.61 typedef AwtGraphicsConfigData* AwtGraphicsConfigDataPtr;
88.1 --- a/src/solaris/native/sun/xawt/XToolkit.c Thu May 21 18:41:50 2009 +0100
88.2 +++ b/src/solaris/native/sun/xawt/XToolkit.c Tue Jun 09 23:47:38 2009 -0700
88.3 @@ -45,10 +45,14 @@
88.4 #include "sun_awt_X11_XToolkit.h"
88.5 #include "java_awt_SystemColor.h"
88.6 #include "java_awt_TrayIcon.h"
88.7 +#include <X11/extensions/XTest.h>
88.8
88.9 uint32_t awt_NumLockMask = 0;
88.10 Boolean awt_ModLockIsShiftLock = False;
88.11
88.12 +static int32_t num_buttons = 0;
88.13 +int32_t getNumButtons();
88.14 +
88.15 extern JavaVM *jvm;
88.16
88.17 // Tracing level
88.18 @@ -575,7 +579,6 @@
88.19 pollFds[1].revents = 0;
88.20 }
88.21
88.22 -
88.23 AWT_NOFLUSH_UNLOCK();
88.24
88.25 /* ACTUALLY DO THE POLL() */
88.26 @@ -684,8 +687,6 @@
88.27 return ret;
88.28 }
88.29
88.30 -static XErrorHandler saved_error_handler = NULL;
88.31 -
88.32 #ifdef __linux__
88.33 void print_stack(void)
88.34 {
88.35 @@ -706,38 +707,6 @@
88.36 }
88.37 #endif
88.38
88.39 -static int NoisyXErrorHandler(Display * dpy, XErrorEvent * event) {
88.40 - fprintf(stderr, "id=%x, serial=%x, ec=%d, rc=%d, mc=%d\n",
88.41 - event->resourceid, event->serial, event->error_code,
88.42 - event->request_code, event->minor_code);
88.43 - /*
88.44 - #ifdef __linux__
88.45 - print_stack();
88.46 - #endif
88.47 - */
88.48 - if (jvm != NULL) {
88.49 - JNIEnv * env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
88.50 - JNU_CallStaticMethodByName(env, NULL, "java/lang/Thread", "dumpStack", "()V");
88.51 - }
88.52 - if (!saved_error_handler) {
88.53 - return saved_error_handler(dpy, event);
88.54 - }
88.55 - return 0;
88.56 -}
88.57 -
88.58 -/*
88.59 - * Class: sun_awt_X11_XToolkit
88.60 - * Method: setNoisyXErrorHandler
88.61 - * Signature: ()V
88.62 - */
88.63 -JNIEXPORT void JNICALL Java_sun_awt_X11_XToolkit_setNoisyXErrorHandler
88.64 -(JNIEnv *env , jclass clazz)
88.65 -{
88.66 - (*env)->GetJavaVM(env, &jvm);
88.67 - saved_error_handler = XSetErrorHandler(NoisyXErrorHandler);
88.68 -}
88.69 -
88.70 -
88.71 Window get_xawt_root_shell(JNIEnv *env) {
88.72 static jclass classXRootWindow = NULL;
88.73 static jmethodID methodGetXRootWindow = NULL;
88.74 @@ -943,3 +912,80 @@
88.75 AWT_UNLOCK();
88.76 }
88.77 }
88.78 +
88.79 +
88.80 +/*
88.81 + * Class: sun_awt_X11_XToolkit
88.82 + * Method: getNumberOfButtonsImpl
88.83 + * Signature: ()I
88.84 + */
88.85 +JNIEXPORT jint JNICALL Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl
88.86 +(JNIEnv * env, jobject cls){
88.87 + if (num_buttons == 0) {
88.88 + num_buttons = getNumButtons();
88.89 + }
88.90 + return num_buttons;
88.91 +}
88.92 +
88.93 +int32_t getNumButtons() {
88.94 + int32_t major_opcode, first_event, first_error;
88.95 + int32_t xinputAvailable;
88.96 + int32_t numDevices, devIdx, clsIdx;
88.97 + XDeviceInfo* devices;
88.98 + XDeviceInfo* aDevice;
88.99 + XButtonInfo* bInfo;
88.100 + int32_t local_num_buttons = 0;
88.101 +
88.102 + /* 4700242:
88.103 + * If XTest is asked to press a non-existant mouse button
88.104 + * (i.e. press Button3 on a system configured with a 2-button mouse),
88.105 + * then a crash may happen. To avoid this, we use the XInput
88.106 + * extension to query for the number of buttons on the XPointer, and check
88.107 + * before calling XTestFakeButtonEvent().
88.108 + */
88.109 + xinputAvailable = XQueryExtension(awt_display, INAME, &major_opcode, &first_event, &first_error);
88.110 + DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XINPUT) returns major_opcode = %d, first_event = %d, first_error = %d",
88.111 + major_opcode, first_event, first_error);
88.112 + if (xinputAvailable) {
88.113 + devices = XListInputDevices(awt_display, &numDevices);
88.114 + for (devIdx = 0; devIdx < numDevices; devIdx++) {
88.115 + aDevice = &(devices[devIdx]);
88.116 +#ifdef IsXExtensionPointer
88.117 + if (aDevice->use == IsXExtensionPointer) {
88.118 + for (clsIdx = 0; clsIdx < aDevice->num_classes; clsIdx++) {
88.119 + if (aDevice->inputclassinfo[clsIdx].class == ButtonClass) {
88.120 + bInfo = (XButtonInfo*)(&(aDevice->inputclassinfo[clsIdx]));
88.121 + local_num_buttons = bInfo->num_buttons;
88.122 + DTRACE_PRINTLN1("RobotPeer: XPointer has %d buttons", num_buttons);
88.123 + break;
88.124 + }
88.125 + }
88.126 + break;
88.127 + }
88.128 +#endif
88.129 + if (local_num_buttons <= 0 ) {
88.130 + if (aDevice->use == IsXPointer) {
88.131 + for (clsIdx = 0; clsIdx < aDevice->num_classes; clsIdx++) {
88.132 + if (aDevice->inputclassinfo[clsIdx].class == ButtonClass) {
88.133 + bInfo = (XButtonInfo*)(&(aDevice->inputclassinfo[clsIdx]));
88.134 + local_num_buttons = bInfo->num_buttons;
88.135 + DTRACE_PRINTLN1("RobotPeer: XPointer has %d buttons", num_buttons);
88.136 + break;
88.137 + }
88.138 + }
88.139 + break;
88.140 + }
88.141 + }
88.142 + }
88.143 +
88.144 + XFreeDeviceList(devices);
88.145 + }
88.146 + else {
88.147 + DTRACE_PRINTLN1("RobotPeer: XINPUT extension is unavailable, assuming %d mouse buttons", num_buttons);
88.148 + }
88.149 + if (local_num_buttons == 0 ) {
88.150 + local_num_buttons = 3;
88.151 + }
88.152 +
88.153 + return local_num_buttons;
88.154 +}
89.1 --- a/src/solaris/native/sun/xawt/XlibWrapper.c Thu May 21 18:41:50 2009 +0100
89.2 +++ b/src/solaris/native/sun/xawt/XlibWrapper.c Tue Jun 09 23:47:38 2009 -0700
89.3 @@ -1186,7 +1186,7 @@
89.4 static int ToolkitErrorHandler(Display * dpy, XErrorEvent * event) {
89.5 if (jvm != NULL) {
89.6 JNIEnv * env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
89.7 - return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit", "GlobalErrorHandler", "(JJ)I",
89.8 + return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit", "globalErrorHandler", "(JJ)I",
89.9 ptr_to_jlong(dpy), ptr_to_jlong(event)).i;
89.10 } else {
89.11 return 0;
89.12 @@ -1229,6 +1229,28 @@
89.13 return (*(XErrorHandler)jlong_to_ptr(handler))((Display*) jlong_to_ptr(display), (XErrorEvent*) jlong_to_ptr(event_ptr));
89.14 }
89.15
89.16 +/*
89.17 + * Class: sun_awt_X11_XlibWrapper
89.18 + * Method: PrintXErrorEvent
89.19 + * Signature: (JJ)V
89.20 + */
89.21 +JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent
89.22 +(JNIEnv *env, jclass clazz, jlong display, jlong event_ptr)
89.23 +{
89.24 + char msg[128];
89.25 + char buf[128];
89.26 +
89.27 + XErrorEvent* err = (XErrorEvent *)jlong_to_ptr(event_ptr);
89.28 +
89.29 + XGetErrorText((Display *)jlong_to_ptr(display), err->error_code, msg, sizeof(msg));
89.30 + jio_fprintf(stderr, "Xerror %s, XID %x, ser# %d\n", msg, err->resourceid, err->serial);
89.31 + jio_snprintf(buf, sizeof(buf), "%d", err->request_code);
89.32 + XGetErrorDatabaseText((Display *)jlong_to_ptr(display), "XRequest", buf, "Unknown", msg, sizeof(msg));
89.33 + jio_fprintf(stderr, "Major opcode %d (%s)\n", err->request_code, msg);
89.34 + if (err->request_code > 128) {
89.35 + jio_fprintf(stderr, "Minor opcode %d\n", err->minor_code);
89.36 + }
89.37 +}
89.38
89.39
89.40 /*
90.1 --- a/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java Thu May 21 18:41:50 2009 +0100
90.2 +++ b/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java Tue Jun 09 23:47:38 2009 -0700
90.3 @@ -527,7 +527,7 @@
90.4 /**
90.5 * @return Whether this is a file system shell folder
90.6 */
90.7 - public synchronized boolean isFileSystem() {
90.8 + public boolean isFileSystem() {
90.9 if (cachedIsFileSystem == null) {
90.10 cachedIsFileSystem = hasAttribute(ATTRIB_FILESYSTEM);
90.11 }
90.12 @@ -543,8 +543,8 @@
90.13 public Boolean call() throws Exception {
90.14 // Caching at this point doesn't seem to be cost efficient
90.15 return (getAttributes0(getParentIShellFolder(),
90.16 - getRelativePIDL(), attribute)
90.17 - & attribute) != 0;
90.18 + getRelativePIDL(), attribute)
90.19 + & attribute) != 0;
90.20 }
90.21 });
90.22 }
90.23 @@ -761,7 +761,7 @@
90.24 /**
90.25 * @return Whether this shell folder is a link
90.26 */
90.27 - public synchronized boolean isLink() {
90.28 + public boolean isLink() {
90.29 if (cachedIsLink == null) {
90.30 cachedIsLink = hasAttribute(ATTRIB_LINK);
90.31 }
90.32 @@ -1160,8 +1160,16 @@
90.33 private static native int compareIDsByColumn(long pParentIShellFolder, long pidl1, long pidl2, int columnIdx);
90.34
90.35
90.36 - public void sortChildren(List<? extends File> files) {
90.37 - Collections.sort(files, new ColumnComparator(getIShellFolder(), 0));
90.38 + public void sortChildren(final List<? extends File> files) {
90.39 + // To avoid loads of synchronizations with Invoker and improve performance we
90.40 + // synchronize the whole code of the sort method once
90.41 + getInvoker().invoke(new Callable<Void>() {
90.42 + public Void call() throws Exception {
90.43 + Collections.sort(files, new ColumnComparator(getIShellFolder(), 0));
90.44 +
90.45 + return null;
90.46 + }
90.47 + });
90.48 }
90.49
90.50 private static class ColumnComparator implements Comparator<File> {
91.1 --- a/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Thu May 21 18:41:50 2009 +0100
91.2 +++ b/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Tue Jun 09 23:47:38 2009 -0700
91.3 @@ -478,21 +478,22 @@
91.4
91.5 public <T> T invoke(Callable<T> task) {
91.6 try {
91.7 - T result;
91.8 if (Thread.currentThread() == comThread) {
91.9 // if it's already called from the COM
91.10 // thread, we don't need to delegate the task
91.11 - result = task.call();
91.12 + return task.call();
91.13 } else {
91.14 - Future<T> future = submit(task);
91.15 - try {
91.16 - result = future.get();
91.17 - } catch (InterruptedException e) {
91.18 - result = null;
91.19 - future.cancel(true);
91.20 + while (true) {
91.21 + Future<T> future = submit(task);
91.22 +
91.23 + try {
91.24 + return future.get();
91.25 + } catch (InterruptedException e) {
91.26 + // Repeat the attempt
91.27 + future.cancel(true);
91.28 + }
91.29 }
91.30 }
91.31 - return result;
91.32 } catch (Exception e) {
91.33 Throwable cause = (e instanceof ExecutionException) ? e.getCause() : e;
91.34 if (cause instanceof RuntimeException) {
92.1 --- a/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java Thu May 21 18:41:50 2009 +0100
92.2 +++ b/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java Tue Jun 09 23:47:38 2009 -0700
92.3 @@ -105,9 +105,10 @@
92.4 }
92.5
92.6 /**
92.7 - * Creates (if needed), clears and returns the buffer for this painter.
92.8 + * Creates (if needed), clears (if requested) and returns the buffer
92.9 + * for this painter.
92.10 */
92.11 - protected abstract Image getBackBuffer();
92.12 + protected abstract Image getBackBuffer(boolean clear);
92.13
92.14 /**
92.15 * Updates the the window associated with this painter with the contents
92.16 @@ -123,31 +124,16 @@
92.17 public abstract void flush();
92.18
92.19 /**
92.20 - * Updates the window associated with the painter given the passed image.
92.21 - * If the passed image is null the painter will use its own buffer for
92.22 - * rendering the contents of the window into it and updating the window.
92.23 + * Updates the window associated with the painter.
92.24 *
92.25 - * If the passed buffer has dimensions different from the window, it is
92.26 - * copied into the internal buffer first and the latter is used to update
92.27 - * the window.
92.28 - *
92.29 - * @param bb the image to update the non opaque window with, or null.
92.30 - * If not null, the image must be of ARGB_PRE type.
92.31 + * @param repaint indicates if the window should be completely repainted
92.32 + * to the back buffer using {@link java.awt.Window#paintAll} before update.
92.33 */
92.34 - public void updateWindow(Image bb) {
92.35 + public void updateWindow(boolean repaint) {
92.36 boolean done = false;
92.37 - if (bb != null && (window.getWidth() != bb.getWidth(null) ||
92.38 - window.getHeight() != bb.getHeight(null)))
92.39 - {
92.40 - Image ourBB = getBackBuffer();
92.41 - Graphics2D g = (Graphics2D)ourBB.getGraphics();
92.42 - g.drawImage(bb, 0, 0, null);
92.43 - g.dispose();
92.44 - bb = ourBB;
92.45 - }
92.46 - do {
92.47 - if (bb == null) {
92.48 - bb = getBackBuffer();
92.49 + Image bb = getBackBuffer(repaint);
92.50 + while (!done) {
92.51 + if (repaint) {
92.52 Graphics2D g = (Graphics2D)bb.getGraphics();
92.53 try {
92.54 window.paintAll(g);
92.55 @@ -156,17 +142,12 @@
92.56 }
92.57 }
92.58
92.59 - peer.paintAppletWarning((Graphics2D)bb.getGraphics(),
92.60 - bb.getWidth(null), bb.getHeight(null));
92.61 -
92.62 done = update(bb);
92.63 - // in case they passed us a lost VI, next time around we'll use our
92.64 - // own bb because we can not validate and restore the contents of
92.65 - // their VI
92.66 if (!done) {
92.67 - bb = null;
92.68 + repaint = true;
92.69 + bb = getBackBuffer(true);
92.70 }
92.71 - } while (!done);
92.72 + }
92.73 }
92.74
92.75 private static final Image clearImage(Image bb) {
92.76 @@ -190,30 +171,24 @@
92.77 * method (VI, BI, regular Images).
92.78 */
92.79 private static class BIWindowPainter extends TranslucentWindowPainter {
92.80 - private WeakReference<BufferedImage> biRef;
92.81 + private BufferedImage backBuffer;
92.82
92.83 protected BIWindowPainter(WWindowPeer peer) {
92.84 super(peer);
92.85 }
92.86
92.87 - private BufferedImage getBIBackBuffer() {
92.88 + @Override
92.89 + protected Image getBackBuffer(boolean clear) {
92.90 int w = window.getWidth();
92.91 int h = window.getHeight();
92.92 - BufferedImage bb = biRef == null ? null : biRef.get();
92.93 - if (bb == null || bb.getWidth() != w || bb.getHeight() != h) {
92.94 - if (bb != null) {
92.95 - bb.flush();
92.96 - bb = null;
92.97 - }
92.98 - bb = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
92.99 - biRef = new WeakReference<BufferedImage>(bb);
92.100 + if (backBuffer == null ||
92.101 + backBuffer.getWidth() != w ||
92.102 + backBuffer.getHeight() != h)
92.103 + {
92.104 + flush();
92.105 + backBuffer = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
92.106 }
92.107 - return (BufferedImage)clearImage(bb);
92.108 - }
92.109 -
92.110 - @Override
92.111 - protected Image getBackBuffer() {
92.112 - return getBIBackBuffer();
92.113 + return clear ? (BufferedImage)clearImage(backBuffer) : backBuffer;
92.114 }
92.115
92.116 @Override
92.117 @@ -246,10 +221,7 @@
92.118 }
92.119
92.120 // copy the passed image into our own buffer, then upload
92.121 - BufferedImage bi = getBIBackBuffer();
92.122 - Graphics2D g = (Graphics2D)bi.getGraphics();
92.123 - g.setComposite(AlphaComposite.Src);
92.124 - g.drawImage(bb, 0, 0, null);
92.125 + BufferedImage bi = (BufferedImage)clearImage(backBuffer);
92.126
92.127 int data[] =
92.128 ((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
92.129 @@ -259,8 +231,9 @@
92.130 }
92.131
92.132 public void flush() {
92.133 - if (biRef != null) {
92.134 - biRef.clear();
92.135 + if (backBuffer != null) {
92.136 + backBuffer.flush();
92.137 + backBuffer = null;
92.138 }
92.139 }
92.140 }
92.141 @@ -271,27 +244,22 @@
92.142 * Java heap-based buffer (which is then uploaded to the layered window)
92.143 */
92.144 private static class VIWindowPainter extends BIWindowPainter {
92.145 - private WeakReference<VolatileImage> viRef;
92.146 + private VolatileImage viBB;
92.147
92.148 protected VIWindowPainter(WWindowPeer peer) {
92.149 super(peer);
92.150 }
92.151
92.152 @Override
92.153 - protected Image getBackBuffer() {
92.154 + protected Image getBackBuffer(boolean clear) {
92.155 int w = window.getWidth();
92.156 int h = window.getHeight();
92.157 GraphicsConfiguration gc = peer.getGraphicsConfiguration();
92.158
92.159 - VolatileImage viBB = viRef == null ? null : viRef.get();
92.160 -
92.161 if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
92.162 viBB.validate(gc) == IMAGE_INCOMPATIBLE)
92.163 {
92.164 - if (viBB != null) {
92.165 - viBB.flush();
92.166 - viBB = null;
92.167 - }
92.168 + flush();
92.169
92.170 if (gc instanceof AccelGraphicsConfig) {
92.171 AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
92.172 @@ -303,21 +271,16 @@
92.173 viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
92.174 }
92.175 viBB.validate(gc);
92.176 - viRef = new WeakReference<VolatileImage>(viBB);
92.177 }
92.178
92.179 - return clearImage(viBB);
92.180 + return clear ? clearImage(viBB) : viBB;
92.181 }
92.182
92.183 @Override
92.184 public void flush() {
92.185 - if (viRef != null) {
92.186 - VolatileImage viBB = viRef.get();
92.187 - if (viBB != null) {
92.188 - viBB.flush();
92.189 - viBB = null;
92.190 - }
92.191 - viRef.clear();
92.192 + if (viBB != null) {
92.193 + viBB.flush();
92.194 + viBB = null;
92.195 }
92.196 }
92.197 }
93.1 --- a/src/windows/classes/sun/awt/windows/WCanvasPeer.java Thu May 21 18:41:50 2009 +0100
93.2 +++ b/src/windows/classes/sun/awt/windows/WCanvasPeer.java Tue Jun 09 23:47:38 2009 -0700
93.3 @@ -78,25 +78,6 @@
93.4 super.paint(g);
93.5 }
93.6
93.7 - public void print(Graphics g) {
93.8 - if (!(target instanceof Window) ||
93.9 - AWTAccessor.getWindowAccessor().isOpaque((Window)target))
93.10 - {
93.11 - Dimension d = ((Component)target).getSize();
93.12 - if (g instanceof Graphics2D ||
93.13 - g instanceof sun.awt.Graphics2Delegate) {
93.14 - // background color is setup correctly, so just use clearRect
93.15 - g.clearRect(0, 0, d.width, d.height);
93.16 - } else {
93.17 - // emulate clearRect
93.18 - g.setColor(((Component)target).getBackground());
93.19 - g.fillRect(0, 0, d.width, d.height);
93.20 - g.setColor(((Component)target).getForeground());
93.21 - }
93.22 - }
93.23 - super.print(g);
93.24 - }
93.25 -
93.26 public boolean shouldClearRectBeforePaint() {
93.27 return eraseBackground;
93.28 }
94.1 --- a/src/windows/classes/sun/awt/windows/WComponentPeer.java Thu May 21 18:41:50 2009 +0100
94.2 +++ b/src/windows/classes/sun/awt/windows/WComponentPeer.java Tue Jun 09 23:47:38 2009 -0700
94.3 @@ -239,7 +239,8 @@
94.4
94.5 private static final double BANDING_DIVISOR = 4.0;
94.6 private native int[] createPrintedPixels(int srcX, int srcY,
94.7 - int srcW, int srcH);
94.8 + int srcW, int srcH,
94.9 + int alpha);
94.10 public void print(Graphics g) {
94.11
94.12 Component comp = (Component)target;
94.13 @@ -261,7 +262,9 @@
94.14 }
94.15 int h = endY - startY + 1;
94.16
94.17 - int[] pix = createPrintedPixels(0, startY, totalW, h);
94.18 + Color bgColor = comp.getBackground();
94.19 + int[] pix = createPrintedPixels(0, startY, totalW, h,
94.20 + bgColor == null ? 255 : bgColor.getAlpha());
94.21 if (pix != null) {
94.22 BufferedImage bim = new BufferedImage(totalW, h,
94.23 BufferedImage.TYPE_INT_ARGB);
94.24 @@ -488,13 +491,14 @@
94.25 }
94.26 }
94.27
94.28 - public void updateGraphicsData(GraphicsConfiguration gc) {
94.29 + public boolean updateGraphicsData(GraphicsConfiguration gc) {
94.30 winGraphicsConfig = (Win32GraphicsConfig)gc;
94.31 try {
94.32 replaceSurfaceData();
94.33 } catch (InvalidPipeException e) {
94.34 // REMIND : what do we do if our surface creation failed?
94.35 }
94.36 + return false;
94.37 }
94.38
94.39 //This will return null for Components not yet added to a Container
95.1 --- a/src/windows/classes/sun/awt/windows/WObjectPeer.java Thu May 21 18:41:50 2009 +0100
95.2 +++ b/src/windows/classes/sun/awt/windows/WObjectPeer.java Tue Jun 09 23:47:38 2009 -0700
95.3 @@ -42,6 +42,9 @@
95.4 // set from JNI if any errors in creating the peer occur
95.5 protected Error createError = null;
95.6
95.7 + // used to synchronize the state of this peer
95.8 + private final Object stateLock = new Object();
95.9 +
95.10 public static WObjectPeer getPeerForTarget(Object t) {
95.11 WObjectPeer peer = (WObjectPeer) WToolkit.targetToPeer(t);
95.12 return peer;
95.13 @@ -55,6 +58,10 @@
95.14 return target;
95.15 }
95.16
95.17 + public final Object getStateLock() {
95.18 + return stateLock;
95.19 + }
95.20 +
95.21 /*
95.22 * Subclasses should override disposeImpl() instead of dispose(). Client
95.23 * code should always invoke dispose(), never disposeImpl().
96.1 --- a/src/windows/classes/sun/awt/windows/WRobotPeer.java Thu May 21 18:41:50 2009 +0100
96.2 +++ b/src/windows/classes/sun/awt/windows/WRobotPeer.java Tue Jun 09 23:47:38 2009 -0700
96.3 @@ -60,8 +60,6 @@
96.4 }
96.5 public native int getRGBPixelImpl(int x, int y);
96.6
96.7 - public native int getNumberOfButtons();
96.8 -
96.9 public int [] getRGBPixels(Rectangle bounds) {
96.10 int pixelArray[] = new int[bounds.width*bounds.height];
96.11 getRGBPixels(bounds.x, bounds.y, bounds.width, bounds.height, pixelArray);
97.1 --- a/src/windows/classes/sun/awt/windows/WToolkit.java Thu May 21 18:41:50 2009 +0100
97.2 +++ b/src/windows/classes/sun/awt/windows/WToolkit.java Tue Jun 09 23:47:38 2009 -0700
97.3 @@ -982,6 +982,16 @@
97.4 return areExtraMouseButtonsEnabled;
97.5 }
97.6
97.7 + private native synchronized int getNumberOfButtonsImpl();
97.8 +
97.9 + @Override
97.10 + public int getNumberOfButtons(){
97.11 + if (numberOfButtons == 0) {
97.12 + numberOfButtons = getNumberOfButtonsImpl();
97.13 + }
97.14 + return (numberOfButtons > MAX_BUTTONS_SUPPORTED)? MAX_BUTTONS_SUPPORTED : numberOfButtons;
97.15 + }
97.16 +
97.17 @Override
97.18 public boolean isWindowOpacitySupported() {
97.19 // supported in Win2K and later
98.1 --- a/src/windows/classes/sun/awt/windows/WWindowPeer.java Thu May 21 18:41:50 2009 +0100
98.2 +++ b/src/windows/classes/sun/awt/windows/WWindowPeer.java Tue Jun 09 23:47:38 2009 -0700
98.3 @@ -54,7 +54,7 @@
98.4
98.5 private boolean isOpaque;
98.6
98.7 - private volatile TranslucentWindowPainter painter;
98.8 + private TranslucentWindowPainter painter;
98.9
98.10 /*
98.11 * A key used for storing a list of active windows in AppContext. The value
98.12 @@ -106,11 +106,13 @@
98.13 GraphicsConfiguration gc = getGraphicsConfiguration();
98.14 ((Win32GraphicsDevice)gc.getDevice()).removeDisplayChangedListener(this);
98.15
98.16 - TranslucentWindowPainter currentPainter = painter;
98.17 - if (currentPainter != null) {
98.18 - currentPainter.flush();
98.19 - // don't set the current one to null here; reduces the chances of
98.20 - // MT issues (like NPEs)
98.21 + synchronized (getStateLock()) {
98.22 + TranslucentWindowPainter currentPainter = painter;
98.23 + if (currentPainter != null) {
98.24 + currentPainter.flush();
98.25 + // don't set the current one to null here; reduces the chances of
98.26 + // MT issues (like NPEs)
98.27 + }
98.28 }
98.29
98.30 super.disposeImpl();
98.31 @@ -178,9 +180,23 @@
98.32
98.33 updateIconImages();
98.34
98.35 - updateShape();
98.36 - updateOpacity();
98.37 - updateOpaque();
98.38 + Shape shape = ((Window)target).getShape();
98.39 + if (shape != null) {
98.40 + applyShape(Region.getInstance(shape, null));
98.41 + }
98.42 +
98.43 + float opacity = ((Window)target).getOpacity();
98.44 + if (opacity < 1.0f) {
98.45 + setOpacity(opacity);
98.46 + }
98.47 +
98.48 + synchronized (getStateLock()) {
98.49 + // default value of a boolean field is 'false', so set isOpaque to
98.50 + // true here explicitly
98.51 + this.isOpaque = true;
98.52 + Color bgColor = ((Window)target).getBackground();
98.53 + setOpaque((bgColor == null) || (bgColor.getAlpha() == 255));
98.54 + }
98.55 }
98.56
98.57 native void createAwtWindow(WComponentPeer parent);
98.58 @@ -214,7 +230,11 @@
98.59 setAlwaysOnTop(alwaysOnTop);
98.60 }
98.61
98.62 - updateWindow(null);
98.63 + synchronized (getStateLock()) {
98.64 + if (!isOpaque) {
98.65 + updateWindow(true);
98.66 + }
98.67 + }
98.68 }
98.69
98.70 // Synchronize the insets members (here & in helper) with actual window
98.71 @@ -334,29 +354,6 @@
98.72 }
98.73 }
98.74
98.75 - private void updateShape() {
98.76 - Shape shape = ((Window)target).getShape();
98.77 - if (shape != null) {
98.78 - applyShape(Region.getInstance(shape, null));
98.79 - }
98.80 - }
98.81 -
98.82 - private void updateOpacity() {
98.83 - float opacity = ((Window)target).getOpacity();
98.84 - if (opacity < 1.0f) {
98.85 - setOpacity(opacity);
98.86 - }
98.87 - }
98.88 -
98.89 - private void updateOpaque() {
98.90 - this.isOpaque = true;
98.91 - // boolean opaque = ((Window)target).isOpaque();
98.92 - boolean opaque = AWTAccessor.getWindowAccessor().isOpaque((Window)target);
98.93 - if (!opaque) {
98.94 - setOpaque(opaque);
98.95 - }
98.96 - }
98.97 -
98.98 native void setMinSize(int width, int height);
98.99
98.100 /*
98.101 @@ -579,6 +576,26 @@
98.102 }
98.103 }
98.104
98.105 + @Override
98.106 + public Graphics getGraphics() {
98.107 + synchronized (getStateLock()) {
98.108 + if (!isOpaque) {
98.109 + return painter.getBackBuffer(false).getGraphics();
98.110 + }
98.111 + }
98.112 + return super.getGraphics();
98.113 + }
98.114 +
98.115 + @Override
98.116 + public void setBackground(Color c) {
98.117 + super.setBackground(c);
98.118 + synchronized (getStateLock()) {
98.119 + if (!isOpaque && ((Window)target).isVisible()) {
98.120 + updateWindow(true);
98.121 + }
98.122 + }
98.123 + }
98.124 +
98.125 private native void setOpacity(int iOpacity);
98.126
98.127 public void setOpacity(float opacity) {
98.128 @@ -600,12 +617,23 @@
98.129 }
98.130
98.131 setOpacity(iOpacity);
98.132 - updateWindow(null);
98.133 +
98.134 + synchronized (getStateLock()) {
98.135 + if (!isOpaque && ((Window)target).isVisible()) {
98.136 + updateWindow(true);
98.137 + }
98.138 + }
98.139 }
98.140
98.141 private native void setOpaqueImpl(boolean isOpaque);
98.142
98.143 public void setOpaque(boolean isOpaque) {
98.144 + synchronized (getStateLock()) {
98.145 + if (this.isOpaque == isOpaque) {
98.146 + return;
98.147 + }
98.148 + }
98.149 +
98.150 Window target = (Window)getTarget();
98.151
98.152 if (!isOpaque) {
98.153 @@ -617,20 +645,17 @@
98.154 }
98.155 }
98.156
98.157 - boolean opaqueChanged = this.isOpaque != isOpaque;
98.158 boolean isVistaOS = Win32GraphicsEnvironment.isVistaOS();
98.159
98.160 - if (opaqueChanged && !isVistaOS){
98.161 + if (!isVistaOS) {
98.162 // non-Vista OS: only replace the surface data if the opacity
98.163 // status changed (see WComponentPeer.isAccelCapable() for more)
98.164 replaceSurfaceDataRecursively(target);
98.165 }
98.166
98.167 - this.isOpaque = isOpaque;
98.168 -
98.169 - setOpaqueImpl(isOpaque);
98.170 -
98.171 - if (opaqueChanged) {
98.172 + synchronized (getStateLock()) {
98.173 + this.isOpaque = isOpaque;
98.174 + setOpaqueImpl(isOpaque);
98.175 if (isOpaque) {
98.176 TranslucentWindowPainter currentPainter = painter;
98.177 if (currentPainter != null) {
98.178 @@ -642,7 +667,7 @@
98.179 }
98.180 }
98.181
98.182 - if (opaqueChanged && isVistaOS) {
98.183 + if (isVistaOS) {
98.184 // On Vista: setting the window non-opaque makes the window look
98.185 // rectangular, though still catching the mouse clicks within
98.186 // its shape only. To restore the correct visual appearance
98.187 @@ -654,42 +679,33 @@
98.188 }
98.189 }
98.190
98.191 - updateWindow(null);
98.192 + if (((Window)target).isVisible()) {
98.193 + updateWindow(true);
98.194 + }
98.195 }
98.196
98.197 public native void updateWindowImpl(int[] data, int width, int height);
98.198
98.199 - public void updateWindow(BufferedImage backBuffer) {
98.200 - if (isOpaque) {
98.201 - return;
98.202 - }
98.203 -
98.204 - Component target = (Component)this.target;
98.205 - if (target.getWidth() <= 0 || target.getHeight() <= 0) {
98.206 - return;
98.207 - }
98.208 -
98.209 - TranslucentWindowPainter currentPainter = painter;
98.210 - if (currentPainter != null) {
98.211 - currentPainter.updateWindow(backBuffer);
98.212 - } else if (log.isLoggable(Level.FINER)) {
98.213 - log.log(Level.FINER,
98.214 - "Translucent window painter is null in updateWindow");
98.215 - }
98.216 + public void updateWindow() {
98.217 + updateWindow(false);
98.218 }
98.219
98.220 - /**
98.221 - * Paints the Applet Warning into the passed Graphics2D. This method is
98.222 - * called by the TranslucentWindowPainter before updating the layered
98.223 - * window.
98.224 - *
98.225 - * @param g Graphics context to paint the warning to
98.226 - * @param w the width of the area
98.227 - * @param h the height of the area
98.228 - * @see TranslucentWindowPainter
98.229 - */
98.230 - public void paintAppletWarning(Graphics2D g, int w, int h) {
98.231 - // REMIND: the applet warning needs to be painted here
98.232 + private void updateWindow(boolean repaint) {
98.233 + Window w = (Window)target;
98.234 + synchronized (getStateLock()) {
98.235 + if (isOpaque || !w.isVisible() ||
98.236 + (w.getWidth() <= 0) || (w.getHeight() <= 0))
98.237 + {
98.238 + return;
98.239 + }
98.240 + TranslucentWindowPainter currentPainter = painter;
98.241 + if (currentPainter != null) {
98.242 + currentPainter.updateWindow(repaint);
98.243 + } else if (log.isLoggable(Level.FINER)) {
98.244 + log.log(Level.FINER,
98.245 + "Translucent window painter is null in updateWindow");
98.246 + }
98.247 + }
98.248 }
98.249
98.250 /*
99.1 --- a/src/windows/native/sun/windows/awt_Component.cpp Thu May 21 18:41:50 2009 +0100
99.2 +++ b/src/windows/native/sun/windows/awt_Component.cpp Tue Jun 09 23:47:38 2009 -0700
99.3 @@ -30,6 +30,7 @@
99.4
99.5 #include "jlong.h"
99.6 #include "awt_AWTEvent.h"
99.7 +#include "awt_BitmapUtil.h"
99.8 #include "awt_Component.h"
99.9 #include "awt_Cursor.h"
99.10 #include "awt_Dimension.h"
99.11 @@ -127,6 +128,7 @@
99.12 jobject component;
99.13 int srcx, srcy;
99.14 int srcw, srch;
99.15 + jint alpha;
99.16 };
99.17 // Struct for _SetRectangularShape() method
99.18 struct SetRectangularShapeStruct {
99.19 @@ -361,8 +363,8 @@
99.20 AwtComponent* AwtComponent::GetComponentImpl(HWND hWnd) {
99.21 AwtComponent *component =
99.22 (AwtComponent *)::GetWindowLongPtr(hWnd, GWLP_USERDATA);
99.23 - DASSERT( !IsBadReadPtr(component, sizeof(AwtComponent)) );
99.24 - DASSERT( component->GetHWnd() == hWnd );
99.25 + DASSERT(!component || !IsBadReadPtr(component, sizeof(AwtComponent)) );
99.26 + DASSERT(!component || component->GetHWnd() == hWnd );
99.27 return component;
99.28 }
99.29
99.30 @@ -1918,11 +1920,14 @@
99.31 mr = mrConsume;
99.32 break;
99.33 }
99.34 - case WM_AWT_CREATE_PRINTED_PIXELS:
99.35 - retValue = (LRESULT)CreatePrintedPixels(*((SIZE *)wParam),
99.36 - *((SIZE *)lParam));
99.37 + case WM_AWT_CREATE_PRINTED_PIXELS: {
99.38 + CreatePrintedPixelsStruct* cpps = (CreatePrintedPixelsStruct*)wParam;
99.39 + SIZE loc = { cpps->srcx, cpps->srcy };
99.40 + SIZE size = { cpps->srcw, cpps->srch };
99.41 + retValue = (LRESULT)CreatePrintedPixels(loc, size, cpps->alpha);
99.42 mr = mrConsume;
99.43 break;
99.44 + }
99.45 case WM_UNDOCUMENTED_CLICKMENUBAR:
99.46 {
99.47 if (::IsWindow(AwtWindow::GetModalBlocker(GetHWnd()))) {
99.48 @@ -4526,18 +4531,20 @@
99.49
99.50 void AwtComponent::FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha)
99.51 {
99.52 - if (bitmapBits) {
99.53 - DWORD* dest = (DWORD*)bitmapBits;
99.54 - //XXX: might be optimized to use one loop (cy*cx -> 0).
99.55 - for (int i = 0; i < size.cy; i++ ) {
99.56 - for (int j = 0; j < size.cx; j++ ) {
99.57 - ((BYTE*)(dest++))[3] = alpha;
99.58 - }
99.59 + if (!bitmapBits) {
99.60 + return;
99.61 + }
99.62 +
99.63 + DWORD* dest = (DWORD*)bitmapBits;
99.64 + //XXX: might be optimized to use one loop (cy*cx -> 0)
99.65 + for (int i = 0; i < size.cy; i++ ) {
99.66 + for (int j = 0; j < size.cx; j++ ) {
99.67 + ((BYTE*)(dest++))[3] = alpha;
99.68 }
99.69 }
99.70 }
99.71
99.72 -jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size) {
99.73 +jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size, int alpha) {
99.74 JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
99.75
99.76 if (!::IsWindowVisible(GetHWnd())) {
99.77 @@ -4549,12 +4556,12 @@
99.78 return NULL;
99.79 }
99.80 HDC hMemoryDC = ::CreateCompatibleDC(hdc);
99.81 - HBITMAP hBitmap = ::CreateCompatibleBitmap(hdc, size.cx, size.cy);
99.82 + void *bitmapBits = NULL;
99.83 + HBITMAP hBitmap = BitmapUtil::CreateARGBBitmap(size.cx, size.cy, &bitmapBits);
99.84 HBITMAP hOldBitmap = (HBITMAP)::SelectObject(hMemoryDC, hBitmap);
99.85 SendMessage(WM_AWT_RELEASEDC, (WPARAM)hdc);
99.86
99.87 - RECT eraseR = { 0, 0, size.cx, size.cy };
99.88 - VERIFY(::FillRect(hMemoryDC, &eraseR, GetBackgroundBrush()));
99.89 + FillBackground(hMemoryDC, size);
99.90
99.91 VERIFY(::SetWindowOrgEx(hMemoryDC, loc.cx, loc.cy, NULL));
99.92
99.93 @@ -4562,6 +4569,14 @@
99.94 // above.
99.95 SendMessage(WM_PRINT, (WPARAM)hMemoryDC, PRF_CLIENT | PRF_NONCLIENT);
99.96
99.97 + // First make sure the system completed any drawing to the bitmap.
99.98 + ::GdiFlush();
99.99 +
99.100 + // WM_PRINT does not fill the alpha-channel of the ARGB bitmap
99.101 + // leaving it equal to zero. Hence we need to fill it manually. Otherwise
99.102 + // the pixels will be considered transparent when interpreting the data.
99.103 + FillAlpha(bitmapBits, size, alpha);
99.104 +
99.105 ::SelectObject(hMemoryDC, hOldBitmap);
99.106
99.107 BITMAPINFO bmi;
99.108 @@ -5937,10 +5952,6 @@
99.109
99.110 CreatePrintedPixelsStruct *cpps = (CreatePrintedPixelsStruct *)param;
99.111 jobject self = cpps->component;
99.112 - jint srcx = cpps->srcx;
99.113 - jint srcy = cpps->srcy;
99.114 - jint srcw = cpps->srcw;
99.115 - jint srch = cpps->srch;
99.116
99.117 jintArray result = NULL;
99.118 AwtComponent *c = NULL;
99.119 @@ -5950,12 +5961,7 @@
99.120 c = (AwtComponent *)pData;
99.121 if (::IsWindow(c->GetHWnd()))
99.122 {
99.123 - SIZE loc = { srcx, srcy };
99.124 - SIZE size = { srcw, srch };
99.125 -
99.126 - result = (jintArray)
99.127 - c->SendMessage(WM_AWT_CREATE_PRINTED_PIXELS, (WPARAM)&loc,
99.128 - (LPARAM)&size);
99.129 + result = (jintArray)c->SendMessage(WM_AWT_CREATE_PRINTED_PIXELS, (WPARAM)cpps, 0);
99.130 }
99.131 ret:
99.132 env->DeleteGlobalRef(self);
99.133 @@ -6749,7 +6755,7 @@
99.134 */
99.135 JNIEXPORT jintArray JNICALL
99.136 Java_sun_awt_windows_WComponentPeer_createPrintedPixels(JNIEnv* env,
99.137 - jobject self, jint srcX, jint srcY, jint srcW, jint srcH)
99.138 + jobject self, jint srcX, jint srcY, jint srcW, jint srcH, jint alpha)
99.139 {
99.140 TRY;
99.141
99.142 @@ -6761,6 +6767,7 @@
99.143 cpps->srcy = srcY;
99.144 cpps->srcw = srcW;
99.145 cpps->srch = srcH;
99.146 + cpps->alpha = alpha;
99.147
99.148 jintArray globalRef = (jintArray)AwtToolkit::GetInstance().SyncCall(
99.149 (void*(*)(void*))AwtComponent::_CreatePrintedPixels, cpps);
100.1 --- a/src/windows/native/sun/windows/awt_Component.h Thu May 21 18:41:50 2009 +0100
100.2 +++ b/src/windows/native/sun/windows/awt_Component.h Tue Jun 09 23:47:38 2009 -0700
100.3 @@ -596,7 +596,7 @@
100.4
100.5 void UpdateColorModel();
100.6
100.7 - jintArray CreatePrintedPixels(SIZE &loc, SIZE &size);
100.8 + jintArray CreatePrintedPixels(SIZE &loc, SIZE &size, int alpha);
100.9
100.10 /*
100.11 * HWND, AwtComponent and Java Peer interaction
100.12 @@ -738,7 +738,6 @@
100.13 virtual void SetDragCapture(UINT flags);
100.14 virtual void ReleaseDragCapture(UINT flags);
100.15
100.16 - //These functions are overridden in AwtWindow to handle non-opaque windows.
100.17 virtual void FillBackground(HDC hMemoryDC, SIZE &size);
100.18 virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
100.19
101.1 --- a/src/windows/native/sun/windows/awt_Robot.cpp Thu May 21 18:41:50 2009 +0100
101.2 +++ b/src/windows/native/sun/windows/awt_Robot.cpp Tue Jun 09 23:47:38 2009 -0700
101.3 @@ -437,9 +437,3 @@
101.4
101.5 CATCH_BAD_ALLOC;
101.6 }
101.7 -
101.8 -JNIEXPORT jint JNICALL Java_sun_awt_windows_WRobotPeer_getNumberOfButtons(
101.9 - JNIEnv *, jobject self)
101.10 -{
101.11 - return GetSystemMetrics(SM_CMOUSEBUTTONS);
101.12 -}
102.1 --- a/src/windows/native/sun/windows/awt_Toolkit.cpp Thu May 21 18:41:50 2009 +0100
102.2 +++ b/src/windows/native/sun/windows/awt_Toolkit.cpp Tue Jun 09 23:47:38 2009 -0700
102.3 @@ -2259,3 +2259,8 @@
102.4 void AwtToolkit::setExtraMouseButtonsEnabled(BOOL enable) {
102.5 m_areExtraMouseButtonsEnabled = enable;
102.6 }
102.7 +
102.8 +JNIEXPORT jint JNICALL Java_sun_awt_windows_WToolkit_getNumberOfButtonsImpl
102.9 +(JNIEnv *, jobject self) {
102.10 + return GetSystemMetrics(SM_CMOUSEBUTTONS);
102.11 +}
103.1 --- a/src/windows/native/sun/windows/awt_Window.cpp Thu May 21 18:41:50 2009 +0100
103.2 +++ b/src/windows/native/sun/windows/awt_Window.cpp Tue Jun 09 23:47:38 2009 -0700
103.3 @@ -464,8 +464,7 @@
103.4 size_t length = env->GetStringLength(javaWarningString) + 1;
103.5 warningString = new WCHAR[length];
103.6 env->GetStringRegion(javaWarningString, 0,
103.7 - static_cast<jsize>(length - 1),
103.8 - reinterpret_cast<jchar*>(warningString));
103.9 + static_cast<jsize>(length - 1), reinterpret_cast<jchar*>(warningString));
103.10 warningString[length-1] = L'\0';
103.11
103.12 env->DeleteLocalRef(javaWarningString);
103.13 @@ -2652,20 +2651,6 @@
103.14 ::LeaveCriticalSection(&contentBitmapCS);
103.15 }
103.16
103.17 -void AwtWindow::FillBackground(HDC hMemoryDC, SIZE &size)
103.18 -{
103.19 - if (isOpaque()) {
103.20 - AwtCanvas::FillBackground(hMemoryDC, size);
103.21 - }
103.22 -}
103.23 -
103.24 -void AwtWindow::FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha)
103.25 -{
103.26 - if (isOpaque()) {
103.27 - AwtCanvas::FillAlpha(bitmapBits, size, alpha);
103.28 - }
103.29 -}
103.30 -
103.31 /*
103.32 * Fixed 6353381: it's improved fix for 4792958
103.33 * which was backed-out to avoid 5059656
104.1 --- a/src/windows/native/sun/windows/awt_Window.h Thu May 21 18:41:50 2009 +0100
104.2 +++ b/src/windows/native/sun/windows/awt_Window.h Tue Jun 09 23:47:38 2009 -0700
104.3 @@ -343,11 +343,6 @@
104.4 BOOL m_iconInherited; /* TRUE if icon is inherited from the owner */
104.5 BOOL m_filterFocusAndActivation; /* Used in the WH_CBT hook */
104.6
104.7 - //These are used in AwtComponent::CreatePrintedPixels. They are overridden
104.8 - //here to handle non-opaque windows.
104.9 - virtual void FillBackground(HDC hMemoryDC, SIZE &size);
104.10 - virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
104.11 -
104.12 inline BOOL IsUntrusted() {
104.13 return warningString != NULL;
104.14 }
105.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
105.2 +++ b/test/javax/swing/JComponent/6683775/bug6683775.java Tue Jun 09 23:47:38 2009 -0700
105.3 @@ -0,0 +1,82 @@
105.4 +/* @test
105.5 + @bug 6683775 6794764
105.6 + @summary Painting artifacts is seen when panel is made setOpaque(false) for a translucent window
105.7 + @author Alexander Potochkin
105.8 + @run main bug6683775
105.9 +*/
105.10 +
105.11 +import com.sun.awt.AWTUtilities;
105.12 +import sun.awt.SunToolkit;
105.13 +
105.14 +import javax.swing.*;
105.15 +import java.awt.*;
105.16 +import java.awt.image.BufferedImage;
105.17 +
105.18 +public class bug6683775 {
105.19 + public static void main(String[] args) throws Exception {
105.20 + GraphicsConfiguration gc = getGC();
105.21 + if (!AWTUtilities.isTranslucencySupported(
105.22 + AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT)
105.23 + || gc == null) {
105.24 + return;
105.25 + }
105.26 + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
105.27 + Robot robot = new Robot();
105.28 + final JFrame testFrame = new JFrame(gc);
105.29 +
105.30 + SwingUtilities.invokeLater(new Runnable() {
105.31 + public void run() {
105.32 + JFrame backgroundFrame = new JFrame("Background frame");
105.33 + backgroundFrame.setUndecorated(true);
105.34 + JPanel panel = new JPanel();
105.35 + panel.setBackground(Color.RED);
105.36 + backgroundFrame.add(panel);
105.37 + backgroundFrame.setSize(200, 200);
105.38 + backgroundFrame.setVisible(true);
105.39 +
105.40 + testFrame.setUndecorated(true);
105.41 + JPanel p = new JPanel();
105.42 + p.setOpaque(false);
105.43 + testFrame.add(p);
105.44 + AWTUtilities.setWindowOpaque(testFrame, false);
105.45 + testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
105.46 + testFrame.setSize(400, 400);
105.47 + testFrame.setLocation(0, 0);
105.48 + testFrame.setVisible(true);
105.49 + }
105.50 + });
105.51 +
105.52 + toolkit.realSync();
105.53 +
105.54 + //robot.getPixelColor() didn't work right for some reason
105.55 + BufferedImage capture = robot.createScreenCapture(new Rectangle(100, 100));
105.56 +
105.57 + int redRGB = Color.RED.getRGB();
105.58 + if (redRGB != capture.getRGB(10, 10)) {
105.59 + throw new RuntimeException("Transparent frame is not transparent!");
105.60 + }
105.61 + }
105.62 +
105.63 + private static GraphicsConfiguration getGC() {
105.64 + GraphicsConfiguration transparencyCapableGC =
105.65 + GraphicsEnvironment.getLocalGraphicsEnvironment()
105.66 + .getDefaultScreenDevice().getDefaultConfiguration();
105.67 + if (!AWTUtilities.isTranslucencyCapable(transparencyCapableGC)) {
105.68 + transparencyCapableGC = null;
105.69 +
105.70 + GraphicsEnvironment env =
105.71 + GraphicsEnvironment.getLocalGraphicsEnvironment();
105.72 + GraphicsDevice[] devices = env.getScreenDevices();
105.73 +
105.74 + for (int i = 0; i < devices.length && transparencyCapableGC == null; i++) {
105.75 + GraphicsConfiguration[] configs = devices[i].getConfigurations();
105.76 + for (int j = 0; j < configs.length && transparencyCapableGC == null; j++) {
105.77 + if (AWTUtilities.isTranslucencyCapable(configs[j])) {
105.78 + transparencyCapableGC = configs[j];
105.79 + }
105.80 + }
105.81 + }
105.82 + }
105.83 + return transparencyCapableGC;
105.84 + }
105.85 +}
106.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
106.2 +++ b/test/javax/swing/JFileChooser/6713352/bug6713352.java Tue Jun 09 23:47:38 2009 -0700
106.3 @@ -0,0 +1,105 @@
106.4 +/*
106.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
106.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
106.7 + *
106.8 + * This code is free software; you can redistribute it and/or modify it
106.9 + * under the terms of the GNU General Public License version 2 only, as
106.10 + * published by the Free Software Foundation.
106.11 + *
106.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
106.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
106.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
106.15 + * version 2 for more details (a copy is included in the LICENSE file that
106.16 + * accompanied this code).
106.17 + *
106.18 + * You should have received a copy of the GNU General Public License version
106.19 + * 2 along with this work; if not, write to the Free Software Foundation,
106.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
106.21 + *
106.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
106.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
106.24 + * have any questions.
106.25 + */
106.26 +
106.27 +/* @test
106.28 + @bug 6713352
106.29 + @summary Deadlock in JFileChooser with synchronized custom FileSystemView
106.30 + @author Pavel Porvatov
106.31 + @run main bug6713352
106.32 +*/
106.33 +
106.34 +import sun.awt.shell.ShellFolder;
106.35 +
106.36 +import javax.swing.*;
106.37 +import javax.swing.filechooser.FileSystemView;
106.38 +import java.io.File;
106.39 +import java.io.FileNotFoundException;
106.40 +import java.io.IOException;
106.41 +
106.42 +public class bug6713352 {
106.43 + public static void main(String[] args) throws Exception {
106.44 + SwingUtilities.invokeAndWait(new Runnable() {
106.45 + public void run() {
106.46 + String tempDir = System.getProperty("java.io.tmpdir");
106.47 +
106.48 + if (tempDir == null || !new File(tempDir).isDirectory()) {
106.49 + tempDir = System.getProperty("user.home");
106.50 + }
106.51 +
106.52 + MyFileSystemView systemView = new MyFileSystemView();
106.53 +
106.54 + synchronized (systemView) { // Get SystemView lock
106.55 + new JFileChooser(systemView);
106.56 +
106.57 + // Wait a little bit. BasicDirectoryModel will lock Invoker and stop on
106.58 + // the bug6713352.MyFileSystemView.getFiles() method
106.59 + try {
106.60 + Thread.sleep(5000);
106.61 + } catch (InterruptedException e) {
106.62 + throw new RuntimeException(e);
106.63 + }
106.64 +
106.65 + try {
106.66 + System.out.println("Try to get Invokers lock");
106.67 +
106.68 + ShellFolder.getShellFolder(new File(tempDir)).listFiles(true);
106.69 + } catch (FileNotFoundException e) {
106.70 + throw new RuntimeException(e);
106.71 + }
106.72 + }
106.73 +
106.74 + // To avoid RejectedExecutionException in BasicDirectoryModel wait a second
106.75 + try {
106.76 + Thread.sleep(1000);
106.77 + } catch (InterruptedException e) {
106.78 + throw new RuntimeException(e);
106.79 + }
106.80 + }
106.81 + });
106.82 + }
106.83 +
106.84 + private static class MyFileSystemView extends FileSystemView {
106.85 +
106.86 + public File createNewFolder(File containingDir) throws IOException {
106.87 + return null;
106.88 + }
106.89 +
106.90 + public File[] getFiles(File dir, boolean useFileHiding) {
106.91 + System.out.println("getFiles start");
106.92 +
106.93 + File[] result;
106.94 +
106.95 + synchronized (this) {
106.96 + result = super.getFiles(dir, useFileHiding);
106.97 + }
106.98 +
106.99 + System.out.println("getFiles finished");
106.100 +
106.101 + return result;
106.102 + }
106.103 +
106.104 + public synchronized Boolean isTraversable(File f) {
106.105 + return super.isTraversable(f);
106.106 + }
106.107 + }
106.108 +}
107.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
107.2 +++ b/test/javax/swing/JInternalFrame/6726866/bug6726866.html Tue Jun 09 23:47:38 2009 -0700
107.3 @@ -0,0 +1,7 @@
107.4 +<html>
107.5 +<body>
107.6 +<applet code="bug6726866.class" width=400 height=100></applet>
107.7 +Drag the internal frame inside the green undecorated window,
107.8 +if you can drag it the test passes, otherwise fails.
107.9 +</body>
107.10 +</html>
108.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
108.2 +++ b/test/javax/swing/JInternalFrame/6726866/bug6726866.java Tue Jun 09 23:47:38 2009 -0700
108.3 @@ -0,0 +1,44 @@
108.4 +/* @test
108.5 + @bug 6726866
108.6 + @summary Repainting artifacts when resizing or dragging JInternalFrames in non-opaque toplevel
108.7 + @author Alexander Potochkin
108.8 + @run applet/manual=yesno bug6726866.html
108.9 +*/
108.10 +
108.11 +import javax.swing.*;
108.12 +import java.awt.*;
108.13 +import java.lang.reflect.Method;
108.14 +
108.15 +public class bug6726866 extends JApplet {
108.16 +
108.17 + public void init() {
108.18 + JFrame frame = new JFrame("bug6726866");
108.19 + frame.setUndecorated(true);
108.20 + setWindowNonOpaque(frame);
108.21 +
108.22 + JDesktopPane desktop = new JDesktopPane();
108.23 + desktop.setBackground(Color.GREEN);
108.24 + JInternalFrame iFrame = new JInternalFrame("Test", true, true, true, true);
108.25 + iFrame.add(new JLabel("internal Frame"));
108.26 + iFrame.setBounds(10, 10, 300, 200);
108.27 + iFrame.setVisible(true);
108.28 + desktop.add(iFrame);
108.29 + frame.add(desktop);
108.30 +
108.31 + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
108.32 + frame.setSize(400, 400);
108.33 + frame.setVisible(true);
108.34 + frame.toFront();
108.35 + }
108.36 +
108.37 + private void setWindowNonOpaque(Window w) {
108.38 + try {
108.39 + Class<?> c = Class.forName("com.sun.awt.AWTUtilities");
108.40 + Method m = c.getMethod("setWindowOpaque", Window.class, boolean.class);
108.41 + m.invoke(null, w, false);
108.42 + }
108.43 + catch (Exception e) {
108.44 + e.printStackTrace();
108.45 + }
108.46 + }
108.47 +}
109.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
109.2 +++ b/test/javax/swing/plaf/nimbus/Test6741426.java Tue Jun 09 23:47:38 2009 -0700
109.3 @@ -0,0 +1,55 @@
109.4 +/*
109.5 + * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
109.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
109.7 + *
109.8 + * This code is free software; you can redistribute it and/or modify it
109.9 + * under the terms of the GNU General Public License version 2 only, as
109.10 + * published by the Free Software Foundation.
109.11 + *
109.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
109.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
109.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
109.15 + * version 2 for more details (a copy is included in the LICENSE file that
109.16 + * accompanied this code).
109.17 + *
109.18 + * You should have received a copy of the GNU General Public License version
109.19 + * 2 along with this work; if not, write to the Free Software Foundation,
109.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
109.21 + *
109.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
109.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
109.24 + * have any questions.
109.25 + */
109.26 +
109.27 +/* @test
109.28 + @bug 6741426
109.29 + @summary Tests reusing Nimbus borders across different components (JComboBox border set on a JTextField)
109.30 + @author Peter Zhelezniakov
109.31 + @run main Test6741426
109.32 +*/
109.33 +
109.34 +import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
109.35 +import javax.swing.*;
109.36 +import java.awt.image.BufferedImage;
109.37 +
109.38 +
109.39 +public class Test6741426 implements Runnable {
109.40 +
109.41 + static final int WIDTH = 160;
109.42 + static final int HEIGHT = 80;
109.43 +
109.44 + @Override public void run() {
109.45 + JComboBox cb = new JComboBox();
109.46 + JTextField tf = new JTextField();
109.47 + tf.setBorder(cb.getBorder());
109.48 + BufferedImage img =
109.49 + new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
109.50 + tf.setSize(WIDTH, HEIGHT);
109.51 + tf.paint(img.getGraphics());
109.52 + }
109.53 +
109.54 + public static void main(String[] args) throws Exception {
109.55 + UIManager.setLookAndFeel(new NimbusLookAndFeel());
109.56 + SwingUtilities.invokeAndWait(new Test6741426());
109.57 + }
109.58 +}