This commit is contained in:
Yuri Nesterenko 2009-06-09 23:47:38 -07:00
commit d094861eeb
109 changed files with 1961 additions and 1007 deletions
jdk
make
src
share/classes
solaris
windows

@ -92,6 +92,7 @@ sanity-all:: sanity-base \
sane-ld_run_path \
sane-alt_bootdir \
sane-bootdir \
sane-local-bootdir \
sane-alsa-headers \
sane-jibx

@ -431,9 +431,11 @@ DEVTOOLS_PATH:=$(call AltCheckSpaces,DEVTOOLS_PATH)
# _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
# _BOOTDIR2: Second choice
# The _BOOTDIR3 is defind optionally.
ifndef ALT_BOOTDIR
_BOOTDIR1 =$(_system_drive)/jdk$(PREVIOUS_JDK_VERSION)
_BOOTDIR2 =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION)
_BOOTDIR3 =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
endif
# 32 bit always needs 2 runtimes, 64 bit usually does too

@ -94,6 +94,21 @@ $(shell \
fi)
endef
# Select a directory if it exists, or the alternate 2, or the alternate 3, or the alternate 4
define DirExists4
$(shell \
if [ -d "$1" ]; then \
echo "$1"; \
elif [ -d "$2" ]; then \
echo "$2"; \
elif [ -d "$3" ]; then \
echo "$3"; \
else \
echo "$4"; \
fi)
endef
# Select a writable directory if it exists and is writable, or the alternate
define WriteDirExists
$(shell \
@ -356,10 +371,15 @@ endif
# BOOTDIR: Bootstrap JDK, previous released JDK.
# _BOOTDIR1 and _BOOTDIR2 picked by platform
# Platform may optionally define _BOOTDIR3 as well.
ifdef ALT_BOOTDIR
BOOTDIR =$(ALT_BOOTDIR)
else
BOOTDIR :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR)
ifdef _BOOTDIR3
BOOTDIR :=$(call DirExists4,$(_BOOTDIR1),$(_BOOTDIR2),$(_BOOTDIR3),/NO_BOOTDIR)
else
BOOTDIR :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR)
endif
endif
export BOOTDIR
BOOTDIR:=$(call AltCheckSpaces,BOOTDIR)

@ -194,7 +194,8 @@ include $(JDK_MAKE_SHARED_DIR)/Sanity-Settings.gmk
sane-outputdir \
sane-alt_bootdir \
sane-bootdir \
sane-cups \
sane-local-bootdir \
sane-cups \
sane-devtools_path \
sane-compiler_path \
sane-unixcommand_path \
@ -766,6 +767,23 @@ sane-bootdir:
"" >> $(ERROR_FILE) ; \
fi
######################################################
# BOOTDIR is recommended to reside on a local drive
######################################################
sane-local-bootdir:
ifeq ($(PLATFORM), windows)
@if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -ci '^J:'` -ne 0 ]; then \
$(ECHO) "WARNING: Your BOOTDIR is located on the J: drive. Often the J:\n" \
" drive is mapped over a network. Using a mapped drive for\n" \
" the BOOTDIR may significantly slow down the build process.\n" \
" You may want to consider using the ALT_BOOTDIR variable\n" \
" to point the build to another location for the BOOTDIR instead. \n" \
" Your current BOOTDIR is:\n" \
" $(BOOTDIR) \n" \
"" >> $(WARNING_FILE) ; \
fi
endif
######################################################
# CACERTS_FILE must be absoulte path and readable
######################################################

@ -21,4 +21,4 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
tzdata2009a
tzdata2009g

@ -258,7 +258,46 @@ Rule Egypt 2007 only - Sep Thu>=1 23:00s 0 -
# unless discontinued, next DST may end Thursday 28 August 2008.
# From Paul Eggert (2007-08-17):
# For lack of better info, assume the new rule is last Thursday in August.
Rule Egypt 2008 max - Aug lastThu 23:00s 0 -
# From Petr Machata (2009-04-06):
# The following appeared in Red Hat bugzilla[1] (edited):
#
# > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 21:59:59 2009 UTC =3D Thu =
# Apr 23
# > 23:59:59 2009 EET isdst=3D0 gmtoff=3D7200
# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 22:00:00 2009 UTC =3D Fri =
# Apr 24
# > 01:00:00 2009 EEST isdst=3D1 gmtoff=3D10800
# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 20:59:59 2009 UTC =3D Thu =
# Aug 27
# > 23:59:59 2009 EEST isdst=3D1 gmtoff=3D10800
# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 21:00:00 2009 UTC =3D Thu =
# Aug 27
# > 23:00:00 2009 EET isdst=3D0 gmtoff=3D7200
#
# > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
# :59)
# > http://support.microsoft.com/kb/958729/
#
# timeanddate[2] and another site I've found[3] also support that.
#
# [1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=3D492263">
# https://bugzilla.redhat.com/show_bug.cgi?id=3D492263
# </a>
# [2] <a href="http://www.timeanddate.com/worldclock/clockchange.html?n=3D53">
# http://www.timeanddate.com/worldclock/clockchange.html?n=3D53
# </a>
# [3] <a href="http://wwp.greenwichmeantime.com/time-zone/africa/egypt/">
# http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
# </a>
# From Arthur David Olson (2009-04-20):
# In 2009 (and for the next several years), Ramadan ends before the fourth
# Thursday in September; Egypt is expected to revert to the last Thursday
# in September.
Rule Egypt 2008 only - Aug lastThu 23:00s 0 -
Rule Egypt 2009 max - Sep lastThu 23:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
@ -586,6 +625,40 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# <a href="http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html">
# http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
# </a>
# From Steffen Thorsen (2009-03-17):
# Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according
# to many sources, such as
# <a href="http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html">
# http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html
# </a>
# <a href="http://www.medi1sat.ma/fr/depeche.aspx?idp=2312">
# http://www.medi1sat.ma/fr/depeche.aspx?idp=2312
# </a>
# (French)
#
# Our summary:
# <a href="http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html">
# http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
# </a>
# From Alexander Krivenyshev (2009-03-17):
# Here is a link to official document from Royaume du Maroc Premier Ministre,
# Ministere de la Modernisation des Secteurs Publics
#
# Under Article 1 of Royal Decree No. 455-67 of Act 23 safar 1387 (2 june 1967)
# concerning the amendment of the legal time, the Ministry of Modernization of
# Public Sectors announced that the official time in the Kingdom will be
# advanced 60 minutes from Sunday 31 May 2009 at midnight.
#
# <a href="http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf">
# http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf
# </a>
#
# <a href="http://www.worldtimezone.com/dst_news/dst_news_morocco03.html">
# http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
# </a>
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Morocco 1939 only - Sep 12 0:00 1:00 S
@ -605,6 +678,8 @@ Rule Morocco 1978 only - Jun 1 0:00 1:00 S
Rule Morocco 1978 only - Aug 4 0:00 0 -
Rule Morocco 2008 only - Jun 1 0:00 1:00 S
Rule Morocco 2008 only - Sep 1 0:00 0 -
Rule Morocco 2009 only - Jun 1 0:00 1:00 S
Rule Morocco 2009 only - Aug 21 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
0:00 Morocco WE%sT 1984 Mar 16
@ -809,6 +884,43 @@ Zone Africa/Lome 0:04:52 - LMT 1893
# Ending : the last Sunday of October at 03:00 ...
# http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=1188&Itemid=50
# From Steffen Thorsen (2009-03-16):
# According to several news sources, Tunisia will not observe DST this year.
# (Arabic)
# <a href="http://www.elbashayer.com/?page=viewn&nid=42546">
# http://www.elbashayer.com/?page=viewn&nid=42546
# </a>
# <a href="http://www.babnet.net/kiwidetail-15295.asp">
# http://www.babnet.net/kiwidetail-15295.asp
# </a>
#
# We have also confirmed this with the US embassy in Tunisia.
# We have a wrap-up about this on the following page:
# <a href="http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html">
# http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
# </a>
# From Alexander Krivenyshev (2009-03-17):
# Here is a link to Tunis Afrique Presse News Agency
#
# Standard time to be kept the whole year long (tap.info.tn):
#
# (in English)
# <a href="http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157">
# http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157
# </a>
#
# (in Arabic)
# <a href="http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1">
# http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1
# </a>
# From Arthur David Olson (2009--3-18):
# The Tunis Afrique Presse News Agency notice contains this: "This measure is due to the fact
# that the fasting month of ramadan coincides with the period concerned by summer time.
# Therefore, the standard time will be kept unchanged the whole year long."
# So foregoing DST seems to be an exception (albeit one that may be repeated in the future).
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Tunisia 1939 only - Apr 15 23:00s 1:00 S
Rule Tunisia 1939 only - Nov 18 23:00s 0 -
@ -833,8 +945,10 @@ Rule Tunisia 1989 only - Mar 26 0:00s 1:00 S
Rule Tunisia 1990 only - May 1 0:00s 1:00 S
Rule Tunisia 2005 only - May 1 0:00s 1:00 S
Rule Tunisia 2005 only - Sep 30 1:00s 0 -
Rule Tunisia 2006 max - Mar lastSun 2:00s 1:00 S
Rule Tunisia 2006 max - Oct lastSun 2:00s 0 -
Rule Tunisia 2006 2008 - Mar lastSun 2:00s 1:00 S
Rule Tunisia 2006 2008 - Oct lastSun 2:00s 0 -
Rule Tunisia 2010 max - Mar lastSun 2:00s 1:00 S
Rule Tunisia 2010 max - Oct lastSun 2:00s 0 -
# Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
# more precise 0:09:21.
# Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11.

@ -1071,6 +1071,40 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u
# http://www.petranews.gov.jo/nepras/2006/Sep/05/4000.htm
# "Jordan will switch to winter time on Friday, October 27".
#
# From Phil Pizzey (2009-04-02):
# ...I think I may have spotted an error in the timezone data for
# Jordan.
# The current (2009d) asia file shows Jordan going to daylight
# saving
# time on the last Thursday in March.
#
# Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
#
# However timeanddate.com, which I usually find reliable, shows Jordan
# going to daylight saving time on the last Friday in March since 2002.
# Please see
# <a href="http://www.timeanddate.com/worldclock/timezone.html?n=11">
# http://www.timeanddate.com/worldclock/timezone.html?n=11
# </a>
# From Steffen Thorsen (2009-04-02):
# This single one might be good enough, (2009-03-24, Arabic):
# <a href="http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279">
# http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279
# </a>
#
# Google's translation:
#
# > The Council of Ministers decided in 2002 to adopt the principle of timely
# > submission of the summer at 60 minutes as of midnight on the last Thursday
# > of the month of March of each year.
#
# So - this means the midnight between Thursday and Friday since 2002.
# From Arthur David Olson (2009-04-06):
# We still have Jordan switching to DST on Thursdays in 2000 and 2001.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Jordan 1973 only - Jun 6 0:00 1:00 S
Rule Jordan 1973 1975 - Oct 1 0:00 0 -
@ -1093,8 +1127,9 @@ Rule Jordan 1993 1998 - Apr Fri>=1 0:00 1:00 S
Rule Jordan 1994 only - Sep Fri>=15 0:00 0 -
Rule Jordan 1995 1998 - Sep Fri>=15 0:00s 0 -
Rule Jordan 1999 only - Jul 1 0:00s 1:00 S
Rule Jordan 1999 2002 - Sep lastThu 0:00s 0 -
Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
Rule Jordan 1999 2002 - Sep lastFri 0:00s 0 -
Rule Jordan 2000 2001 - Mar lastThu 0:00s 1:00 S
Rule Jordan 2002 max - Mar lastFri 0:00s 1:00 S
Rule Jordan 2003 only - Oct 24 0:00s 0 -
Rule Jordan 2004 only - Oct 15 0:00s 0 -
Rule Jordan 2005 only - Sep lastFri 0:00s 0 -
@ -1576,11 +1611,46 @@ Zone Asia/Muscat 3:54:20 - LMT 1920
# http://dailymailnews.com/200808/28/news/dmbrn03.html
# </a>
# From Alexander Krivenyshev (2009-04-08):
# Based on previous media reports that "... proposed plan to
# advance clocks by one hour from May 1 will cause disturbance
# to the working schedules rather than bringing discipline in
# official working."
# <a href="http://www.thenews.com.pk/daily_detail.asp?id=171280">
# http://www.thenews.com.pk/daily_detail.asp?id=171280
# </a>
#
# recent news that instead of May 2009 - Pakistan plan to
# introduce DST from April 15, 2009
#
# FYI: Associated Press Of Pakistan
# April 08, 2009
# Cabinet okays proposal to advance clocks by one hour from April 15
# <a href="http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1">
# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1
# </a>
#
# or
#
# <a href="http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html">
# http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html
# </a>
#
# ....
# The Federal Cabinet on Wednesday approved the proposal to
# advance clocks in the country by one hour from April 15 to
# conserve energy"
# From Arthur David Olson (2009-04-10):
# Assume for now that Pakistan will end DST in 2009 as it did in 2008.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Pakistan 2002 only - Apr Sun>=2 0:01 1:00 S
Rule Pakistan 2002 only - Oct Sun>=2 0:01 0 -
Rule Pakistan 2008 only - Jun 1 0:00 1:00 S
Rule Pakistan 2008 only - Nov 1 0:00 0 -
Rule Pakistan 2009 only - Apr 15 0:00 1:00 S
Rule Pakistan 2009 only - Nov 1 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Karachi 4:28:12 - LMT 1907
5:30 - IST 1942 Sep
@ -1717,6 +1787,22 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# http://www.worldtimezone.com/dst_news/dst_news_gazastrip01.html
# </a>
# From Alexander Krivenyshev (2009-03-26):
# According to the Palestine News Network (arabic.pnn.ps), Palestinian
# government decided to start Daylight Time on Thursday night March
# 26 and continue until the night of 27 September 2009.
#
# (in Arabic)
# <a href="http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850">
# http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850
# </a>
#
# or
# (English translation)
# <a href="http://www.worldtimezone.com/dst_news/dst_news_westbank01.html">
# http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
# </a>
# The rules for Egypt are stolen from the `africa' file.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@ -1730,10 +1816,12 @@ Rule Palestine 1999 2005 - Apr Fri>=15 0:00 1:00 S
Rule Palestine 1999 2003 - Oct Fri>=15 0:00 0 -
Rule Palestine 2004 only - Oct 1 1:00 0 -
Rule Palestine 2005 only - Oct 4 2:00 0 -
Rule Palestine 2006 max - Apr 1 0:00 1:00 S
Rule Palestine 2006 2008 - Apr 1 0:00 1:00 S
Rule Palestine 2006 only - Sep 22 0:00 0 -
Rule Palestine 2007 only - Sep Thu>=8 2:00 0 -
Rule Palestine 2008 max - Aug lastThu 2:00 0 -
Rule Palestine 2008 only - Aug lastFri 2:00 0 -
Rule Palestine 2009 max - Mar lastFri 0:00 1:00 S
Rule Palestine 2009 max - Sep lastMon 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
@ -1991,8 +2079,29 @@ Rule Syria 2007 only - Nov Fri>=1 0:00 0 -
# http://sana.sy/ara/2/2008/10/07/195459.htm
# </a>
Rule Syria 2008 max - Apr Fri>=1 0:00 1:00 S
# From Steffen Thorsen (2009-03-19):
# Syria will start DST on 2009-03-27 00:00 this year according to many sources,
# two examples:
#
# <a href="http://www.sana.sy/eng/21/2009/03/17/217563.htm">
# http://www.sana.sy/eng/21/2009/03/17/217563.htm
# </a>
# (English, Syrian Arab News # Agency)
# <a href="http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209">
# http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209
# </a>
# (Arabic, gov-site)
#
# We have not found any sources saying anything about when DST ends this year.
#
# Our summary
# <a href="http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html">
# http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
# </a>
Rule Syria 2008 only - Apr Fri>=1 0:00 1:00 S
Rule Syria 2008 max - Nov 1 0:00 0 -
Rule Syria 2009 max - Mar lastFri 0:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Damascus 2:25:12 - LMT 1920 # Dimashq

@ -75,40 +75,32 @@ Leap 2008 Dec 31 23:59:60 + S
# SERVICE DE LA ROTATION TERRESTRE
# OBSERVATOIRE DE PARIS
# 61, Av. de l'Observatoire 75014 PARIS (France)
# Tel. : 33 (0) 1 40 51 22 26
# Tel. : 33 (0) 1 40 51 22 29
# FAX : 33 (0) 1 40 51 22 91
# e-mail : services.iers@obspm.fr
# http://hpiers.obspm.fr/eop-pc
# Internet : services.iers@obspm.fr
#
# Paris, 4 July 2008
# Paris, 15 January 2009
#
# Bulletin C 36
# Bulletin C 37
#
# To authorities responsible
# for the measurement and
# distribution of time
#
# UTC TIME STEP
# on the 1st of January 2009
# INFORMATION ON UTC - TAI
#
# A positive leap second will be introduced at the end of December 2008.
# The sequence of dates of the UTC second markers will be:
# NO positive leap second will be introduced at the end of June 2009.
# The difference between Coordinated Universal Time UTC and the
# International Atomic Time TAI is :
#
# 2008 December 31, 23h 59m 59s
# 2008 December 31, 23h 59m 60s
# 2009 January 1, 0h 0m 0s
#
# The difference between UTC and the International Atomic Time TAI is:
#
# from 2006 January 1, 0h UTC, to 2009 January 1 0h UTC : UTC-TAI = - 33s
# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = - 34s
# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
#
# Leap seconds can be introduced in UTC at the end of the months of December
# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
# six months, either to announce a time step in UTC or to confirm that there
# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
# six months, either to announce a time step in UTC, or to confirm that there
# will be no time step at the next possible date.
#
# Daniel GAMBIS
# Head
# Earth Orientation Center of IERS
# Head
# Earth Orientation Center of the IERS
# Observatoire de Paris, France

@ -2280,6 +2280,25 @@ Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose
# From Arthur David Olson (2008-03-12):
# Assume Sun>=15 (third Sunday) going forward.
# From Alexander Krivenyshev (2009-03-04)
# According to the Radio Reloj - Cuba will start Daylight Saving Time on
# midnight between Saturday, March 07, 2009 and Sunday, March 08, 2009-
# not on midnight March 14 / March 15 as previously thought.
#
# <a href="http://www.worldtimezone.com/dst_news/dst_news_cuba05.html">
# http://www.worldtimezone.com/dst_news/dst_news_cuba05.html
# (in Spanish)
# </a>
# From Arthur David Olson (2009-03-09)
# I listened over the Internet to
# <a href="http://media.enet.cu/readioreloj">
# http://media.enet.cu/readioreloj
# </a>
# this morning; when it was 10:05 a. m. here in Bethesda, Maryland the
# the time was announced as "diez cinco"--the same time as here, indicating
# that has indeed switched to DST. Assume second Sunday from 2009 forward.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Cuba 1928 only - Jun 10 0:00 1:00 D
Rule Cuba 1928 only - Oct 10 0:00 0 S
@ -2312,7 +2331,8 @@ Rule Cuba 1998 2003 - Oct lastSun 0:00s 0 S
Rule Cuba 2000 2004 - Apr Sun>=1 0:00s 1:00 D
Rule Cuba 2006 max - Oct lastSun 0:00s 0 S
Rule Cuba 2007 only - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2008 max - Mar Sun>=15 0:00s 1:00 D
Rule Cuba 2008 only - Mar Sun>=15 0:00s 1:00 D
Rule Cuba 2009 max - Mar Sun>=8 0:00s 1:00 D
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Havana -5:29:28 - LMT 1890

@ -373,6 +373,50 @@ Rule Arg 2008 max - Oct Sun>=15 0:00 1:00 S
# keep America/Cordoba a single region rather than splitting it into the
# other 5 subregions.
# From Mariano Absatz (2009-03-13):
# Yesterday (with our usual 2-day notice) the Province of San Luis
# decided that next Sunday instead of "staying" @utc-03:00 they will go
# to utc-04:00 until the second Saturday in October...
#
# The press release is at
# <a href="http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102">
# http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102
# </a>
# (I couldn't find the decree, but
# <a href="http://www.sanluis.gov.ar">
# www.sanluis.gov.ar
# <a/>
# is the official page for the Province Government).
#
# There's also a note in only one of the major national papers (La Nación) at
# <a href="http://www.lanacion.com.ar/nota.asp?nota_id=1107912">
# http://www.lanacion.com.ar/nota.asp?nota_id=1107912
# </a>
#
# The press release says:
# (...) anunció que el próximo domingo a las 00:00 los puntanos deberán
# atrasar una hora sus relojes.
#
# A partir de entonces, San Luis establecerá el huso horario propio de
# la Provincia. De esta manera, durante el periodo del calendario anual
# 2009, el cambio horario quedará comprendido entre las 00:00 del tercer
# domingo de marzo y las 24:00 del segundo sábado de octubre.
# Quick&dirty translation
# (...) announced that next Sunday, at 00:00, Puntanos (the San Luis
# inhabitants) will have to turn back one hour their clocks
#
# Since then, San Luis will establish its own Province timezone. Thus,
# during 2009, this timezone change will run from 00:00 the third Sunday
# in March until 24:00 of the second Saturday in October.
# From Arthur David Olson (2009-03-16):
# The unofficial claim at
# <a href="http://www.timeanddate.com/news/time/san-luis-new-time-zone.html">
# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
# </a>
# is that "The province will most likely follow the next daylight saving schedule,
# which is planned for the second Sunday in October."
#
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
#
@ -520,7 +564,8 @@ Zone America/Argentina/San_Luis -4:25:24 - LMT 1894 Oct 31
-3:00 - ART 2004 May 31
-4:00 - WART 2004 Jul 25
-3:00 Arg AR%sT 2008 Jan 21
-3:00 - ART
-3:00 - ART 2009 Mar 15
-4:00 Arg WAR%sT
#
# Santa Cruz (SC)
Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31

@ -128,6 +128,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XlibWrapper_SetToolkitErrorHandler;
Java_sun_awt_X11_XlibWrapper_XSetErrorHandler;
Java_sun_awt_X11_XlibWrapper_CallErrorHandler;
Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent;
Java_sun_awt_X11_XlibWrapper_XInternAtoms;
Java_sun_awt_X11_XlibWrapper_XChangeWindowAttributes;
Java_sun_awt_X11_XlibWrapper_XDeleteProperty;
@ -154,7 +155,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl;
Java_sun_awt_X11_XRobotPeer_mouseWheelImpl;
Java_sun_awt_X11_XRobotPeer_setup;
Java_sun_awt_X11_XRobotPeer_getNumberOfButtonsImpl;
Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl;
Java_java_awt_Component_initIDs;
Java_java_awt_Container_initIDs;
Java_java_awt_Button_initIDs;
@ -276,7 +277,6 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XToolkit_getDefaultXColormap;
Java_sun_awt_X11_XToolkit_getDefaultScreenData;
Java_sun_awt_X11_XToolkit_getEnv;
Java_sun_awt_X11_XToolkit_setNoisyXErrorHandler;
Java_sun_awt_X11_XlibWrapper_XCreateBitmapFromData;
Java_sun_awt_X11_XlibWrapper_XFreePixmap;
Java_sun_awt_X11_XlibWrapper_XAllocColor;

@ -1038,15 +1038,25 @@ public abstract class Component implements ImageObserver, MenuContainer,
void setGraphicsConfiguration(GraphicsConfiguration gc) {
synchronized(getTreeLock()) {
graphicsConfig = gc;
ComponentPeer peer = getPeer();
if (peer != null) {
peer.updateGraphicsData(gc);
if (updateGraphicsData(gc)) {
removeNotify();
addNotify();
}
}
}
boolean updateGraphicsData(GraphicsConfiguration gc) {
checkTreeLock();
graphicsConfig = gc;
ComponentPeer peer = getPeer();
if (peer != null) {
return peer.updateGraphicsData(gc);
}
return false;
}
/**
* Checks that this component's <code>GraphicsDevice</code>
* <code>idString</code> matches the string argument.

@ -1113,16 +1113,17 @@ public class Container extends Component {
}
@Override
void setGraphicsConfiguration(GraphicsConfiguration gc) {
synchronized (getTreeLock()) {
super.setGraphicsConfiguration(gc);
boolean updateGraphicsData(GraphicsConfiguration gc) {
checkTreeLock();
for (Component comp : component) {
if (comp != null) {
comp.setGraphicsConfiguration(gc);
}
boolean ret = super.updateGraphicsData(gc);
for (Component comp : component) {
if (comp != null) {
ret |= comp.updateGraphicsData(gc);
}
}
return ret;
}
/**

@ -436,7 +436,7 @@ public abstract class GraphicsConfiguration {
}
/**
* Returns whether this GraphicsConfiguration supports
* Returns whether this {@code GraphicsConfiguration} supports
* the {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
* PERPIXEL_TRANSLUCENT} kind of translucency.
*

@ -246,7 +246,7 @@ public abstract class GraphicsDevice {
* Simulated full-screen mode resizes
* the window to the size of the screen and positions it at (0,0).
* <p>
* When entering full-screen mode, if the window to be used as the
* When entering full-screen mode, if the window to be used as a
* full-screen window is not visible, this method will make it visible.
* It will remain visible when returning to windowed mode.
* <p>
@ -261,9 +261,9 @@ public abstract class GraphicsDevice {
*
* @param w a window to use as the full-screen window; {@code null}
* if returning to windowed mode. Some platforms expect the
* fullscreen window to be a top-level component (i.e., a Frame);
* therefore it is preferable to use a Frame here rather than a
* Window.
* fullscreen window to be a top-level component (i.e., a {@code Frame});
* therefore it is preferable to use a {@code Frame} here rather than a
* {@code Window}.
*
* @see #isFullScreenSupported
* @see #getFullScreenWindow

@ -96,9 +96,13 @@ public class Robot {
init(GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice());
int tmpMask = 0;
if (Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
for (int i = 0; i < peer.getNumberOfButtons(); i++){
tmpMask |= InputEvent.getMaskForButton(i+1);
if (Toolkit.getDefaultToolkit() instanceof SunToolkit) {
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
for (int i = 0; i < buttonsNumber; i++){
tmpMask |= InputEvent.getMaskForButton(i+1);
}
}
}
tmpMask |= InputEvent.BUTTON1_MASK|

@ -296,7 +296,7 @@ public class Window extends Container implements Accessible {
transient boolean isInShow = false;
/*
* Opacity level of the window
* The opacity level of the window
*
* @serial
* @see #setOpacity(float)
@ -306,7 +306,7 @@ public class Window extends Container implements Accessible {
private float opacity = 1.0f;
/*
* The shape assigned to this window. This field is set to null if
* The shape assigned to this window. This field is set to {@code null} if
* no shape is set (rectangular window).
*
* @serial
@ -3592,10 +3592,10 @@ public class Window extends Container implements Accessible {
@Override
public void setBackground(Color bgColor) {
Color oldBg = getBackground();
super.setBackground(bgColor);
if (oldBg != null && oldBg.equals(bgColor)) {
return;
}
super.setBackground(bgColor);
int oldAlpha = oldBg != null ? oldBg.getAlpha() : 255;
int alpha = bgColor.getAlpha();
if ((oldAlpha == 255) && (alpha < 255)) { // non-opaque window
@ -3623,16 +3623,37 @@ public class Window extends Container implements Accessible {
}
}
private void updateWindow(BufferedImage backBuffer) {
private void updateWindow() {
synchronized (getTreeLock()) {
WindowPeer peer = (WindowPeer)getPeer();
if (peer != null) {
peer.updateWindow(backBuffer);
peer.updateWindow();
}
}
}
private static final Color TRANSPARENT_BACKGROUND_COLOR = new Color(0, 0, 0, 0);
/**
* {@inheritDoc}
*
* @since 1.7
*/
@Override
public void paint(Graphics g) {
Color bgColor = getBackground();
if ((bgColor != null) && (bgColor.getAlpha() < 255)) {
Graphics gg = g.create();
try {
if (gg instanceof Graphics2D) {
gg.setColor(bgColor);
((Graphics2D)gg).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC));
gg.fillRect(0, 0, getWidth(), getHeight());
}
} finally {
gg.dispose();
}
}
super.paint(g);
}
private static void setLayersOpaque(Component component, boolean isOpaque) {
// Shouldn't use instanceof to avoid loading Swing classes
@ -3644,18 +3665,10 @@ public class Window extends Container implements Accessible {
Container c = root.getContentPane();
javax.swing.JComponent content =
(c instanceof javax.swing.JComponent) ? (javax.swing.JComponent)c : null;
javax.swing.JComponent gp =
(rpc.getGlassPane() instanceof javax.swing.JComponent) ?
(javax.swing.JComponent)rpc.getGlassPane() : null;
if (gp != null) {
gp.setDoubleBuffered(isOpaque);
}
lp.setOpaque(isOpaque);
root.setOpaque(isOpaque);
root.setDoubleBuffered(isOpaque);
if (content != null) {
content.setOpaque(isOpaque);
content.setDoubleBuffered(isOpaque);
// Iterate down one level to see whether we have a JApplet
// (which is also a RootPaneContainer) which requires processing
@ -3748,8 +3761,8 @@ public class Window extends Container implements Accessible {
window.setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue(),
opaque ? 255 : 0));
}
public void updateWindow(Window window, BufferedImage backBuffer) {
window.updateWindow(backBuffer);
public void updateWindow(Window window) {
window.updateWindow();
}
public Dimension getSecurityWarningSize(Window window) {

@ -157,6 +157,8 @@ public abstract class InputEvent extends ComponentEvent {
/**
* An array of extended modifiers for additional buttons.
* @see getButtonDownMasks
* There are twenty buttons fit into 4byte space.
* one more bit is reserved for FIRST_HIGH_BIT.
* @since 7.0
*/
private static final int [] BUTTON_DOWN_MASK = new int [] { BUTTON1_DOWN_MASK,
@ -169,7 +171,16 @@ public abstract class InputEvent extends ComponentEvent {
1<<18,
1<<19,
1<<20,
1<<21 };
1<<21,
1<<22,
1<<23,
1<<24,
1<<25,
1<<26,
1<<27,
1<<28,
1<<29,
1<<30};
/**
* A method to access an array of extended modifiers for additional buttons.
@ -240,7 +251,7 @@ public abstract class InputEvent extends ComponentEvent {
// in fact, it is undesirable to add modifier bits
// to the same field as this may break applications
// see bug# 5066958
static final int FIRST_HIGH_BIT = 1 << 22;
static final int FIRST_HIGH_BIT = 1 << 31;
static final int JDK_1_3_MODIFIERS = SHIFT_DOWN_MASK - 1;
static final int HIGH_MODIFIERS = ~( FIRST_HIGH_BIT - 1 );

@ -33,6 +33,7 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.awt.IllegalComponentStateException;
import java.awt.MouseInfo;
import sun.awt.SunToolkit;
/**
* An event which indicates that a mouse action occurred in a component.
@ -379,12 +380,25 @@ public class MouseEvent extends InputEvent {
*/
private static final long serialVersionUID = -991214153494842848L;
/**
* A number of buttons available on the mouse at the {@code Toolkit} machinery startup.
*/
private static int cachedNumberOfButtons;
static {
/* ensure that the necessary native libraries are loaded */
NativeLibLoader.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
final Toolkit tk = Toolkit.getDefaultToolkit();
if (tk instanceof SunToolkit) {
cachedNumberOfButtons = ((SunToolkit)tk).getNumberOfButtons();
} else {
//It's expected that some toolkits (Headless,
//whatever besides SunToolkit) could also operate.
cachedNumberOfButtons = 3;
}
}
/**
@ -411,15 +425,6 @@ public class MouseEvent extends InputEvent {
return new Point(xAbs, yAbs);
}
/**
* A number of buttons available on the mouse at the {@code Toolkit} machinery startup.
*/
private static int cachedNumberOfButtons;
static {
cachedNumberOfButtons = MouseInfo.getNumberOfButtons();
}
/**
* Returns the absolute horizontal x position of the event.
* In a virtual device multi-screen environment in which the
@ -735,7 +740,6 @@ public class MouseEvent extends InputEvent {
if (button < NOBUTTON){
throw new IllegalArgumentException("Invalid button value :" + button);
}
//TODO: initialize MouseInfo.cachedNumber on toolkit creation.
if (button > BUTTON3) {
if (!Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
throw new IllegalArgumentException("Extra mouse events are disabled " + button);

@ -548,7 +548,8 @@ public interface ComponentPeer {
/**
* Updates internal data structures related to the component's GC.
*
* @return if the peer needs to be recreated for the changes to take effect
* @since 1.7
*/
void updateGraphicsData(GraphicsConfiguration gc);
boolean updateGraphicsData(GraphicsConfiguration gc);
}

@ -121,11 +121,4 @@ public interface RobotPeer
* Disposes the robot peer when it is not needed anymore.
*/
void dispose();
/**
* Returns the number of buttons that the robot simulates.
*
* @return the number of buttons that the robot simulates
*/
int getNumberOfButtons();
}

@ -110,12 +110,11 @@ public interface WindowPeer extends ContainerPeer {
void setOpaque(boolean isOpaque);
/**
* Updates the native part of non-opaque window using
* the given image with color+alpha values for each pixel.
* Updates the native part of non-opaque window.
*
* @see Window#setBackground(Color)
*/
void updateWindow(BufferedImage backBuffer);
void updateWindow();
/**
* Instructs the peer to update the position of the security warning.

@ -34,6 +34,9 @@ import java.awt.event.ComponentListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
/** This is an implementation of the <code>DesktopManager</code>.
* It currently implements the basic behaviors for managing
* <code>JInternalFrame</code>s in an arbitrary parent.
@ -361,7 +364,7 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
g.dispose();
}
} else if (dragMode == FASTER_DRAG_MODE) {
dragFrameFaster(f, newX, newY);
dragFrameFaster(f, newX, newY);
} else {
setBoundsForFrame(f, newX, newY, f.getWidth(), f.getHeight());
}
@ -634,13 +637,8 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
boolean floaterCollision = isFloaterCollision(previousBounds, currentBounds);
// System.out.println(previousBounds);
JComponent parent = (JComponent)f.getParent();
Rectangle visBounds = previousBounds.intersection(desktopBounds);
// System.out.println(previousBounds);
// System.out.println(visBounds);
RepaintManager currentManager = RepaintManager.currentManager(f);
@ -682,7 +680,6 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
} else {
dirtyRects = new Rectangle[1];
dirtyRects[0] = previousBounds;
// System.out.println("no intersection");
};
// Fix the damage
@ -701,14 +698,22 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
parent.paintImmediately(dirtyRects[i]);
((JInternalFrame)f).isDragging = true;
// System.out.println(dirtyRects[i]);
}
}
} finally {
currentManager.endPaint();
}
// update window if it's non-opaque
Window topLevel = SwingUtilities.getWindowAncestor(f);
Toolkit tk = Toolkit.getDefaultToolkit();
if (!AWTAccessor.getWindowAccessor().isOpaque(topLevel) &&
(tk instanceof SunToolkit) &&
((SunToolkit)tk).needUpdateWindow())
{
AWTAccessor.getWindowAccessor().updateWindow(topLevel);
}
}
private boolean isFloaterCollision(Rectangle moveFrom, Rectangle moveTo) {

@ -1021,8 +1021,10 @@ public abstract class JComponent extends Container implements Serializable,
int bw,bh;
boolean printing = getFlag(IS_PRINTING);
if(!printing && repaintManager.isDoubleBufferingEnabled() &&
!getFlag(ANCESTOR_USING_BUFFER) && isDoubleBuffered()) {
if (!printing && repaintManager.isDoubleBufferingEnabled() &&
!getFlag(ANCESTOR_USING_BUFFER) && isDoubleBuffered() &&
(getFlag(IS_REPAINTING) || repaintManager.isPainting()))
{
repaintManager.beginPaint();
try {
repaintManager.paint(this, this, co, clipX, clipY, clipW,

@ -43,7 +43,6 @@ import sun.security.action.GetPropertyAction;
import com.sun.java.swing.SwingUtilities3;
/**
* This class manages repaint requests, allowing the number
* of repaints to be minimized, for example by collapsing multiple
@ -717,14 +716,12 @@ public class RepaintManager
}
}
private Map<Component,Rectangle>
updateWindows(Map<Component,Rectangle> dirtyComponents)
{
private void updateWindows(Map<Component,Rectangle> dirtyComponents) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (!(toolkit instanceof SunToolkit &&
((SunToolkit)toolkit).needUpdateWindow()))
{
return dirtyComponents;
return;
}
Set<Window> windows = new HashSet<Window>();
@ -734,25 +731,20 @@ public class RepaintManager
Window window = dirty instanceof Window ?
(Window)dirty :
SwingUtilities.getWindowAncestor(dirty);
if (window != null &&
!AWTAccessor.getWindowAccessor().isOpaque(window))
{
// if this component's toplevel is perpixel translucent, it will
// be repainted below
it.remove();
// add to the set of windows to update (so that we don't update
// the window many times for each component to be repainted that
// belongs to this window)
windows.add(window);
}
}
for (Window window : windows) {
AWTAccessor.getWindowAccessor().updateWindow(window, null);
AWTAccessor.getWindowAccessor().updateWindow(window);
}
}
return dirtyComponents;
boolean isPainting() {
return painting;
}
/**
@ -788,10 +780,6 @@ public class RepaintManager
int localBoundsW;
Enumeration keys;
// the components belonging to perpixel-translucent windows will be
// removed from the list
tmpDirtyComponents = updateWindows(tmpDirtyComponents);
roots = new ArrayList<Component>(count);
for (Component dirty : tmpDirtyComponents.keySet()) {
@ -799,13 +787,11 @@ public class RepaintManager
}
count = roots.size();
// System.out.println("roots size is " + count);
painting = true;
try {
for(i=0 ; i < count ; i++) {
dirtyComponent = roots.get(i);
rect = tmpDirtyComponents.get(dirtyComponent);
// System.out.println("Should refresh :" + rect);
localBoundsH = dirtyComponent.getHeight();
localBoundsW = dirtyComponent.getWidth();
@ -848,6 +834,9 @@ public class RepaintManager
} finally {
painting = false;
}
updateWindows(tmpDirtyComponents);
tmpDirtyComponents.clear();
}
@ -1004,6 +993,16 @@ public class RepaintManager
return delegate.getVolatileOffscreenBuffer(c, proposedWidth,
proposedHeight);
}
// If the window is non-opaque, it's double-buffered at peer's level
Window w = (c instanceof Window) ? (Window)c : SwingUtilities.getWindowAncestor(c);
if (!AWTAccessor.getWindowAccessor().isOpaque(w)) {
Toolkit tk = Toolkit.getDefaultToolkit();
if ((tk instanceof SunToolkit) && (((SunToolkit)tk).needUpdateWindow())) {
return null;
}
}
GraphicsConfiguration config = c.getGraphicsConfiguration();
if (config == null) {
config = GraphicsEnvironment.getLocalGraphicsEnvironment().
@ -1031,6 +1030,15 @@ public class RepaintManager
DoubleBufferInfo doubleBuffer;
int width, height;
// If the window is non-opaque, it's double-buffered at peer's level
Window w = (c instanceof Window) ? (Window)c : SwingUtilities.getWindowAncestor(c);
if (!AWTAccessor.getWindowAccessor().isOpaque(w)) {
Toolkit tk = Toolkit.getDefaultToolkit();
if ((tk instanceof SunToolkit) && (((SunToolkit)tk).needUpdateWindow())) {
return null;
}
}
if (standardDoubleBuffer == null) {
standardDoubleBuffer = new DoubleBufferInfo();
}

@ -230,51 +230,46 @@ public class BasicDirectoryModel extends AbstractListModel implements PropertyCh
}
public void run0() {
FileSystemView fileSystem = filechooser.getFileSystemView();
File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
if (isInterrupted()) {
return;
}
final Vector<File> newFileCache = new Vector<File>();
Vector<File> newFiles = new Vector<File>();
// run through the file list, add directories and selectable files to fileCache
// Note that this block must be OUTSIDE of Invoker thread because of
// deadlock possibility with custom synchronized FileSystemView
for (File file : list) {
if (filechooser.accept(file)) {
boolean isTraversable = filechooser.isTraversable(file);
if (isTraversable) {
newFileCache.addElement(file);
} else if (filechooser.isFileSelectionEnabled()) {
newFiles.addElement(file);
}
if (isInterrupted()) {
return;
}
}
}
// First sort alphabetically by filename
sort(newFileCache);
sort(newFiles);
newFileCache.addAll(newFiles);
// To avoid loads of synchronizations with Invoker and improve performance we
// execute the whole block on the COM thread
DoChangeContents doChangeContents = ShellFolder.getInvoker().invoke(new Callable<DoChangeContents>() {
public DoChangeContents call() throws Exception {
FileSystemView fileSystem = filechooser.getFileSystemView();
File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
Vector<File> acceptsList = new Vector<File>();
if (isInterrupted()) {
return null;
}
// run through the file list, add directories and selectable files to fileCache
for (File file : list) {
if (filechooser.accept(file)) {
acceptsList.addElement(file);
}
}
if (isInterrupted()) {
return null;
}
// First sort alphabetically by filename
sort(acceptsList);
Vector<File> newDirectories = new Vector<File>(50);
Vector<File> newFiles = new Vector<File>();
// run through list grabbing directories in chunks of ten
for (int i = 0; i < acceptsList.size(); i++) {
File f = acceptsList.elementAt(i);
boolean isTraversable = filechooser.isTraversable(f);
if (isTraversable) {
newDirectories.addElement(f);
} else if (!isTraversable && filechooser.isFileSelectionEnabled()) {
newFiles.addElement(f);
}
if (isInterrupted()) {
return null;
}
}
Vector<File> newFileCache = new Vector<File>(newDirectories);
newFileCache.addAll(newFiles);
int newSize = newFileCache.size();
int oldSize = fileCache.size();

@ -4201,8 +4201,9 @@
<stateType key="Disabled"/>
<stateType key="Focused"/>
<stateType key="Editable">
<codeSnippet><![CDATA[
return ((JComboBox)c).isEditable();]]></codeSnippet>
<codeSnippet><![CDATA[
return c instanceof JComboBox && ((JComboBox)c).isEditable();
]]></codeSnippet>
</stateType>
</stateTypes>
<contentMargins top="0" bottom="0" left="0" right="0"/>
@ -16160,12 +16161,14 @@
<stateType key="Disabled"/>
<stateType key="Indeterminate">
<codeSnippet><![CDATA[
return ((JProgressBar)c).isIndeterminate();
return c instanceof JProgressBar &&
((JProgressBar)c).isIndeterminate();
]]></codeSnippet>
</stateType>
<stateType key="Finished">
<codeSnippet><![CDATA[
return ((JProgressBar)c).getPercentComplete() == 1.0;
return c instanceof JProgressBar &&
((JProgressBar)c).getPercentComplete() == 1.0;
]]></codeSnippet>
</stateType>
</stateTypes>
@ -25845,26 +25848,26 @@
<stateTypes>
<stateType key="North">
<codeSnippet><![CDATA[
JToolBar toolbar = (JToolBar)c;
return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.NORTH;
return (c instanceof JToolBar) &&
NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.NORTH;
]]></codeSnippet>
</stateType>
<stateType key="East">
<codeSnippet><![CDATA[
JToolBar toolbar = (JToolBar)c;
return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.EAST;
return (c instanceof JToolBar) &&
NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.EAST;
]]></codeSnippet>
</stateType>
<stateType key="West">
<codeSnippet><![CDATA[
JToolBar toolbar = (JToolBar)c;
return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.WEST;
return (c instanceof JToolBar) &&
NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.WEST;
]]></codeSnippet>
</stateType>
<stateType key="South">
<codeSnippet><![CDATA[
JToolBar toolbar = (JToolBar)c;
return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.SOUTH;
return (c instanceof JToolBar) &&
NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.SOUTH;
]]></codeSnippet>
</stateType>
</stateTypes>

@ -132,7 +132,7 @@ public final class AWTAccessor {
/*
* Update the image of a non-opaque (translucent) window.
*/
void updateWindow(Window window, BufferedImage backBuffer);
void updateWindow(Window window);
/** Get the size of the security warning.
*/

@ -592,8 +592,9 @@ public abstract class EmbeddedFrame extends Frame
public void setOpaque(boolean isOpaque) {
}
public void updateWindow(BufferedImage bi) {
public void updateWindow() {
}
public void repositionSecurityWarning() {
}
}

@ -179,9 +179,15 @@ public class HeadlessToolkit extends Toolkit
throw new HeadlessException();
}
public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager)
throws HeadlessException {
throw new HeadlessException();
public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
// See 6833019.
return
new KeyboardFocusManagerPeer() {
public Window getCurrentFocusedWindow() { return null; }
public void setCurrentFocusOwner(Component comp) {}
public Component getCurrentFocusOwner() { return null; }
public void clearGlobalFocusOwner(Window activeWindow) {}
};
}
public TrayIconPeer createTrayIcon(TrayIcon target)

@ -300,7 +300,9 @@ public class NullComponentPeer implements LightweightPeer,
public void setZOrder(ComponentPeer above) {
}
public void updateGraphicsData(GraphicsConfiguration gc) {}
public boolean updateGraphicsData(GraphicsConfiguration gc) {
return false;
}
public GraphicsConfiguration getAppropriateGraphicsConfiguration(
GraphicsConfiguration gc)

@ -89,6 +89,25 @@ public abstract class SunToolkit extends Toolkit
*/
private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue";
/**
* Number of buttons.
* By default it's taken from the system. If system value does not
* fit into int type range, use our own MAX_BUTTONS_SUPPORT value.
*/
protected static int numberOfButtons = 0;
/* XFree standard mention 24 buttons as maximum:
* http://www.xfree86.org/current/mouse.4.html
* We workaround systems supporting more than 24 buttons.
* Otherwise, we have to use long type values as masks
* which leads to API change.
* InputEvent.BUTTON_DOWN_MASK may contain only 21 masks due to
* the 4-bytes limit for the int type. (CR 6799099)
* One more bit is reserved for FIRST_HIGH_BIT.
*/
public final static int MAX_BUTTONS_SUPPORTED = 20;
public SunToolkit() {
/* If awt.threadgroup is set to class name the instance of
* this class is created (should be subclass of ThreadGroup)
@ -2079,6 +2098,12 @@ public abstract class SunToolkit extends Toolkit
return false;
}
/**
* Descendants of the SunToolkit should override and put their own logic here.
*/
public int getNumberOfButtons(){
return 3;
}
} // class SunToolkit

@ -274,45 +274,61 @@ public abstract class ShellFolder extends File {
// Override File methods
public static void sort(List<? extends File> files) {
public static void sort(final List<? extends File> files) {
if (files == null || files.size() <= 1) {
return;
}
// Check that we can use the ShellFolder.sortChildren() method:
// 1. All files have the same non-null parent
// 2. All files is ShellFolders
File commonParent = null;
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
getInvoker().invoke(new Callable<Void>() {
public Void call() throws Exception {
// Check that we can use the ShellFolder.sortChildren() method:
// 1. All files have the same non-null parent
// 2. All files is ShellFolders
File commonParent = null;
for (File file : files) {
File parent = file.getParentFile();
for (File file : files) {
File parent = file.getParentFile();
if (parent == null || !(file instanceof ShellFolder)) {
commonParent = null;
if (parent == null || !(file instanceof ShellFolder)) {
commonParent = null;
break;
}
break;
}
if (commonParent == null) {
commonParent = parent;
} else {
if (commonParent != parent && !commonParent.equals(parent)) {
commonParent = null;
if (commonParent == null) {
commonParent = parent;
} else {
if (commonParent != parent && !commonParent.equals(parent)) {
commonParent = null;
break;
break;
}
}
}
}
}
if (commonParent instanceof ShellFolder) {
((ShellFolder) commonParent).sortChildren(files);
} else {
Collections.sort(files, FILE_COMPARATOR);
}
if (commonParent instanceof ShellFolder) {
((ShellFolder) commonParent).sortChildren(files);
} else {
Collections.sort(files, FILE_COMPARATOR);
}
return null;
}
});
}
public void sortChildren(List<? extends File> files) {
Collections.sort(files, FILE_COMPARATOR);
public void sortChildren(final List<? extends File> files) {
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
getInvoker().invoke(new Callable<Void>() {
public Void call() throws Exception {
Collections.sort(files, FILE_COMPARATOR);
return null;
}
});
}
public boolean isAbsolute() {

@ -402,6 +402,11 @@ public class GTKKeybindings {
"released SPACE", "released",
"RETURN", "pressed"
}),
"RootPane.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[]{
"shift F10", "postPopup",
"CONTEXT_MENU", "postPopup"
}),
// These bindings are only enabled when there is a default
// button set on the rootpane.
"RootPane.defaultButtonWindowKeyBindings", new Object[]{

@ -360,6 +360,11 @@ public class WindowsKeybindings {
"DOWN", "decrement",
"KP_DOWN", "decrement",
}),
"RootPane.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[]{
"shift F10", "postPopup",
"CONTEXT_MENU", "postPopup"
}),
// These bindings are only enabled when there is a default
// button set on the rootpane.
"RootPane.defaultButtonWindowKeyBindings", new Object[]{

@ -171,6 +171,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
"Truk Summer Time", "TRUST"};
String ULAT[]= new String[] {"Ulaanbaatar Time", "ULAT",
"Ulaanbaatar Summer Time", "ULAST"};
String WART[] = new String[] {"Western Argentine Time", "WART",
"Western Argentine Summer Time", "WARST"};
String WAT[] = new String[] {"Western African Time", "WAT",
"Western African Summer Time", "WAST"};
String WET[] = new String[] {"Western European Time", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

@ -171,6 +171,8 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
"Truk Sommerzeit", "TRUST"};
String ULAT[]= new String[] {"Ulaanbaatar Zeit", "ULAT",
"Ulaanbaatar Sommerzeit", "ULAST"};
String WART[] = new String[] {"Argentinische Zeit", "WART",
"Argentinische Sommerzeit", "WARST"};
String WAT[] = new String[] {"Westafrikanische Zeit", "WAT",
"Westafrikanische Sommerzeit", "WAST"};
String WET[] = new String[] {"Westeurop\u00e4ische Zeit", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

@ -171,6 +171,8 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
"Hora de verano de Truk", "TRUST"};
String ULAT[]= new String[] {"Hora de Ulan Bator", "ULAT",
"Hora de verano de Ulan Bator", "ULAST"};
String WART[] = new String[] {"Hora de Argentina", "WART",
"Hora de verano de Argentina", "WARST"};
String WAT[] = new String[] {"Hora de \u00c1frica Occidental", "WAT",
"Hora de verano de \u00c1frica Occidental", "WAST"};
String WET[] = new String[] {"Hora de Europa Occidental", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

@ -171,6 +171,8 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
"Heure d'\u00e9t\u00e9 de Truk", "TRUST"};
String ULAT[]= new String[] {"Heure de l'Ulaanbaatar", "ULAT",
"Heure d'\u00e9t\u00e9 de l'Ulaanbaatar", "ULAST"} ;
String WART[] = new String[] {"Heure D'Argentine", "WART",
"Heure d'\u00e9t\u00e9 D'Argentine", "WARST"} ;
String WAT[] = new String[] {"Heure d'Afrique de l'Ouest", "WAT",
"Heure d'\u00e9t\u00e9 d'Afrique de l'Ouest", "WAST"} ;
String WET[] = new String[] {"Heure d'Europe de l'Ouest", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

@ -171,6 +171,8 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
"Ora estiva di Truk", "TRUST"};
String ULAT[]= new String[] {"Ora di Ulaanbaatar", "ULAT",
"Ora estiva di Ulaanbaatar", "ULAST"};
String WART[] = new String[] {"Ora dell'Argentina", "WART",
"Ora estiva dell'Argentina", "WARST"};
String WAT[] = new String[] {"Ora dell'Africa occidentale", "WAT",
"Ora estiva dell'Africa occidentale", "WAST"};
String WET[] = new String[] {"Ora dell'Europa occidentale", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

@ -171,6 +171,8 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
"\u30c8\u30e9\u30c3\u30af\u590f\u6642\u9593", "TRUST"};
String ULAT[]= new String[] {"\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u6642\u9593", "ULAT",
"\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u590f\u6642\u9593", "ULAST"};
String WART[] = new String[] {"\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "WART",
"\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u590f\u6642\u9593", "WARST"};
String WAT[] = new String[] {"\u897f\u30a2\u30d5\u30ea\u30ab\u6642\u9593", "WAT",
"\u897f\u30a2\u30d5\u30ea\u30ab\u590f\u6642\u9593", "WAST"};
String WET[] = new String[] {"\u897f\u30e8\u30fc\u30ed\u30c3\u30d1\u6642\u9593", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

@ -171,6 +171,8 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
"\ud2b8\ub8e8\ud06c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "TRUST"};
String ULAT[]= new String[] {"\uc6b8\ub780\ubc14\ud0c0\ub974 \uc2dc\uac04", "ULAT",
"\uc6b8\ub780\ubc14\ud0c0\ub974 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "ULAST"};
String WART[] = new String[] {"\uc544\ub974\ud5e8\ud2f0\ub098 \uc2dc\uac04", "WART",
"\uc544\ub974\ud5e8\ud2f0\ub098 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WARST"};
String WAT[] = new String[] {"\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc2dc\uac04", "WAT",
"\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WAST"};
String WET[] = new String[] {"\uc11c\uc720\ub7fd \uc2dc\uac04", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

@ -171,6 +171,8 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
"Truk, sommartid", "TRUST"};
String ULAT[]= new String[] {"Ulaanbaatar, normaltid", "ULAT",
"Ulaanbaatar, sommartid", "ULAST"};
String WART[] = new String[] {"Argentina, normaltid", "WART",
"Argentina, sommartid", "WARST"};
String WAT[] = new String[] {"V\u00e4stafrikansk tid", "WAT",
"V\u00e4stafrikansk sommartid", "WAST"};
String WET[] = new String[] {"V\u00e4steuropeisk tid", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

@ -171,6 +171,8 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
"\u7279\u9c81\u514b\u590f\u4ee4\u65f6", "TRUST"};
String ULAT[]= new String[] {"\u5e93\u4f26\u65f6\u95f4", "ULAT",
"\u5e93\u4f26\u590f\u4ee4\u65f6", "ULAST"};
String WART[] = new String[] {"\u963f\u6839\u5ef7\u65f6\u95f4", "WART",
"\u963f\u6839\u5ef7\u590f\u4ee4\u65f6", "WARST"};
String WAT[] = new String[] {"\u897f\u975e\u65f6\u95f4", "WAT",
"\u897f\u975e\u590f\u4ee4\u65f6", "WAST"};
String WET[] = new String[] {"\u897f\u6b27\u65f6\u95f4", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

@ -171,6 +171,8 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
"\u7279\u9b6f\u514b\u590f\u4ee4\u6642\u9593", "TRUST"};
String ULAT[]= new String[] {"\u5eab\u502b\u6642\u9593", "ULAT",
"\u5eab\u502b\u590f\u4ee4\u6642\u9593", "ULAST"};
String WART[] = new String[] {"\u963f\u6839\u5ef7\u6642\u9593", "WART",
"\u963f\u6839\u5ef7\u590f\u4ee4\u6642\u9593", "WARST"};
String WAT[] = new String[] {"\u897f\u975e\u6642\u9593", "WAT",
"\u897f\u975e\u590f\u4ee4\u6642\u9593", "WAST"};
String WET[] = new String[] {"\u897f\u6b50\u6642\u9593", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

@ -120,7 +120,7 @@ class MotifDnDConstants {
false,
XConstants.AnyPropertyType);
try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status == XConstants.Success &&
wpg.getData() != 0 &&
@ -190,7 +190,7 @@ class MotifDnDConstants {
try {
Native.putLong(data, motifWindow);
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
defaultRootWindow,
XA_MOTIF_DRAG_WINDOW.getAtom(),
@ -280,7 +280,7 @@ class MotifDnDConstants {
false,
XA_MOTIF_DRAG_TARGETS.getAtom());
try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success
|| wpg.getActualType() != XA_MOTIF_DRAG_TARGETS.getAtom()
@ -394,7 +394,7 @@ class MotifDnDConstants {
}
}
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
motifWindow,
XA_MOTIF_DRAG_TARGETS.getAtom(),
@ -410,7 +410,7 @@ class MotifDnDConstants {
// Create a new motif window and retry.
motifWindow = createMotifWindow();
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
motifWindow,
XA_MOTIF_DRAG_TARGETS.getAtom(),
@ -534,7 +534,7 @@ class MotifDnDConstants {
// CARD32 icc_handle
unsafe.putInt(structData + 4, (int)XA_MOTIF_ATOM_0.getAtom());
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
XA_MOTIF_ATOM_0.getAtom(),
XA_MOTIF_DRAG_INITIATOR_INFO.getAtom(),
@ -567,7 +567,7 @@ class MotifDnDConstants {
unsafe.putShort(data + 10, (short)0); /* pad */
unsafe.putInt(data + 12, dataSize);
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),

@ -184,7 +184,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
XConstants.AnyPropertyType);
try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
/*
* DragICCI.h:

@ -102,7 +102,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
XConstants.AnyPropertyType);
try {
status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
/*
* DragICCI.h:
@ -162,7 +162,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
unsafe.putInt(data + 12, dataSize);
}
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
@ -204,7 +204,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
XConstants.AnyPropertyType);
try {
status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
/*
* DragICCI.h:
@ -236,7 +236,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
unsafe.putInt(data + 4, tproxy);
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
@ -276,7 +276,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
XConstants.AnyPropertyType);
try {
status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
/*
* DragICCI.h:
@ -325,7 +325,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
XConstants.AnyPropertyType);
try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
@ -375,7 +375,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
MotifDnDConstants.XA_MOTIF_DRAG_INITIATOR_INFO.getAtom());
try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status == XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() ==
@ -412,7 +412,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
*/
XWindowAttributes wattr = new XWindowAttributes();
try {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
source_win, wattr.pData);
@ -429,7 +429,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
wattr.dispose();
}
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
source_win_mask |
XConstants.StructureNotifyMask);
@ -1020,7 +1020,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
if (sourceWindow != 0) {
XToolkit.awtLock();
try {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
sourceWindowMask);
XToolkit.RESTORE_XERROR_HANDLER();

@ -75,7 +75,7 @@ public class WindowPropertyGetter {
public int execute() {
return execute(null);
}
public int execute(XToolkit.XErrorHandler errorHandler) {
public int execute(XErrorHandler errorHandler) {
XToolkit.awtLock();
try {
@ -94,7 +94,7 @@ public class WindowPropertyGetter {
// Fix for performance problem - IgnodeBadWindowHandler is
// used too much without reason, just ignore it
if (errorHandler == XToolkit.IgnoreBadWindowHandler) {
if (errorHandler instanceof XErrorHandler.IgnoreBadWindowHandler) {
errorHandler = null;
}

@ -126,7 +126,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
new WindowPropertyGetter(owner, xSettingsPropertyAtom, 0, MAX_LENGTH,
false, xSettingsPropertyAtom.getAtom() );
try {
int status = getter.execute(XToolkit.IgnoreBadWindowHandler);
int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success || getter.getData() == 0) {
if (log.isLoggable(Level.FINE)) log.fine("OH OH : getter failed status = " + status );

@ -989,8 +989,17 @@ public class XBaseWindow {
*/
public void handleButtonPressRelease(XEvent xev) {
XButtonEvent xbe = xev.get_xbutton();
/*
* Ignore the buttons above 20 due to the bit limit for
* InputEvent.BUTTON_DOWN_MASK.
* One more bit is reserved for FIRST_HIGH_BIT.
*/
if (xbe.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
return;
}
int buttonState = 0;
for (int i = 0; i<XToolkit.getNumMouseButtons(); i++){
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
for (int i = 0; i<buttonsNumber; i++){
// A bug in WM implementation: extra buttons doesn't have state!=0 as they should on Release message.
if ((i != 4) && (i != 5)){
buttonState |= (xbe.get_state() & XConstants.buttonsMask[i]);
@ -1026,7 +1035,9 @@ public class XBaseWindow {
* Checks ButtonRelease released all Mouse buttons
*/
static boolean isFullRelease(int buttonState, int button) {
if (button < 0 || button > XToolkit.getNumMouseButtons()) {
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
if (button < 0 || button > buttonsNumber) {
return buttonState == 0;
} else {
return buttonState == XConstants.buttonsMask[button - 1];

@ -1429,7 +1429,26 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
}
}
public void updateGraphicsData(GraphicsConfiguration gc) {
public boolean updateGraphicsData(GraphicsConfiguration gc) {
int oldVisual = -1, newVisual = -1;
if (graphicsConfig != null) {
oldVisual = graphicsConfig.getVisual();
}
if (gc != null && gc instanceof X11GraphicsConfig) {
newVisual = ((X11GraphicsConfig)gc).getVisual();
}
// If the new visual differs from the old one, the peer must be
// recreated because X11 does not allow changing the visual on the fly.
// So we even skip the initGraphicsConfiguration() call.
// The initial assignment should happen though, hence the != -1 thing.
if (oldVisual != -1 && oldVisual != newVisual) {
return true;
}
initGraphicsConfiguration();
doValidateSurface();
return false;
}
}

@ -1100,7 +1100,8 @@ abstract class XDecoratedPeer extends XWindowPeer {
}
boolean isOverrideRedirect() {
return false;
// return false;
return ((XToolkit)Toolkit.getDefaultToolkit()).isOverrideRedirect((Window)target);
}
public boolean requestWindowFocus(long time, boolean timeProvided) {

@ -96,7 +96,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
action_count++;
}
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XDnDConstants.XA_XdndActionList.setAtomData(window,
XAtom.XA_ATOM,
data, action_count);
@ -117,7 +117,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
try {
Native.put(data, formats);
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XDnDConstants.XA_XdndTypeList.setAtomData(window,
XAtom.XA_ATOM,
data, formats.length);
@ -195,7 +195,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1,
false, XConstants.AnyPropertyType);
int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
int status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
@ -215,7 +215,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
0, 1, false, XAtom.XA_WINDOW);
try {
status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status == XConstants.Success &&
wpg2.getData() != 0 &&
@ -233,7 +233,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
0, 1, false, XAtom.XA_WINDOW);
try {
status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success ||
wpg3.getData() == 0 ||
@ -249,7 +249,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
XConstants.AnyPropertyType);
try {
status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success ||
wpg4.getData() == 0 ||

@ -88,7 +88,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
try {
Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION);
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XDnDConstants.XA_XdndAware.setAtomData(window, XAtom.XA_ATOM, data, 1);
XToolkit.RESTORE_XERROR_HANDLER();
@ -122,7 +122,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
false, XConstants.AnyPropertyType);
try {
status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
@ -141,7 +141,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
0, 1, false, XAtom.XA_WINDOW);
try {
status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status == XConstants.Success &&
wpg2.getData() != 0 &&
@ -159,7 +159,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
0, 1, false, XAtom.XA_WINDOW);
try {
status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success ||
wpg3.getData() == 0 ||
@ -175,7 +175,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
XConstants.AnyPropertyType);
try {
status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success ||
wpg4.getData() == 0 ||
@ -205,7 +205,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
/* The proxy window must have the XdndAware set, as XDnD protocol
prescribes to check the proxy window for XdndAware. */
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XDnDConstants.XA_XdndAware.setAtomData(newProxy, XAtom.XA_ATOM,
data, 1);
XToolkit.RESTORE_XERROR_HANDLER();
@ -219,7 +219,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
Native.putLong(data, 0, newProxy);
/* The proxy window must have the XdndProxy set to point to itself.*/
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XDnDConstants.XA_XdndProxy.setAtomData(newProxy, XAtom.XA_WINDOW,
data, 1);
XToolkit.RESTORE_XERROR_HANDLER();
@ -232,7 +232,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION);
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM,
data, 1);
XToolkit.RESTORE_XERROR_HANDLER();
@ -245,7 +245,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
Native.putLong(data, 0, newProxy);
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW,
data, 1);
XToolkit.RESTORE_XERROR_HANDLER();
@ -278,7 +278,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
try {
Native.putLong(data, 0, entry.getVersion());
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM,
data, 1);
XToolkit.RESTORE_XERROR_HANDLER();
@ -291,7 +291,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
Native.putLong(data, 0, (int)entry.getProxy());
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW,
data, 1);
XToolkit.RESTORE_XERROR_HANDLER();
@ -329,7 +329,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
false, XConstants.AnyPropertyType);
try {
status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
@ -348,7 +348,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
0, 1, false, XAtom.XA_WINDOW);
try {
status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status == XConstants.Success &&
wpg2.getData() != 0 &&
@ -366,7 +366,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
0, 1, false, XAtom.XA_WINDOW);
try {
status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success ||
wpg3.getData() == 0 ||
@ -382,7 +382,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
XConstants.AnyPropertyType);
try {
status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success ||
wpg4.getData() == 0 ||
@ -411,7 +411,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
false, XConstants.AnyPropertyType);
try {
int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
int status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
@ -473,7 +473,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
0, 0xFFFF, false,
XAtom.XA_ATOM);
try {
wpg.execute(XToolkit.IgnoreBadWindowHandler);
wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (wpg.getActualType() == XAtom.XA_ATOM &&
wpg.getActualFormat() == 32) {
@ -505,7 +505,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
0, 0xFFFF, false,
XAtom.XA_ATOM);
try {
wpg.execute(XToolkit.IgnoreBadWindowHandler);
wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (wpg.getActualType() == XAtom.XA_ATOM &&
wpg.getActualFormat() == 32) {
@ -541,7 +541,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
*/
XWindowAttributes wattr = new XWindowAttributes();
try {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
source_win, wattr.pData);
@ -558,7 +558,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
wattr.dispose();
}
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
source_win_mask |
XConstants.StructureNotifyMask);
@ -963,7 +963,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
if (sourceWindow != 0) {
XToolkit.awtLock();
try {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
sourceWindowMask);
XToolkit.RESTORE_XERROR_HANDLER();
@ -1104,14 +1104,14 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
0, 0xFFFF, false,
XAtom.XA_ATOM);
try {
wpg.execute(XToolkit.IgnoreBadWindowHandler);
wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (wpg.getActualType() == XAtom.XA_ATOM &&
wpg.getActualFormat() == 32) {
XToolkit.awtLock();
try {
XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XDnDConstants.XA_XdndTypeList.setAtomData(xclient.get_window(),
XAtom.XA_ATOM,
wpg.getData(),

@ -42,6 +42,7 @@ import sun.awt.ComponentAccessor;
import sun.awt.dnd.SunDragSourceContextPeer;
import sun.awt.dnd.SunDropTargetContextPeer;
import sun.awt.SunToolkit;
/**
* The XDragSourceContextPeer class is the class responsible for handling
@ -665,6 +666,15 @@ public final class XDragSourceContextPeer
return true;
case XConstants.ButtonRelease: {
XButtonEvent xbutton = ev.get_xbutton();
/*
* Ignore the buttons above 20 due to the bit limit for
* InputEvent.BUTTON_DOWN_MASK.
* One more bit is reserved for FIRST_HIGH_BIT.
*/
if (xbutton.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
return true;
}
/*
* On some X servers it could happen that ButtonRelease coordinates
* differ from the latest MotionNotify coordinates, so we need to

@ -181,7 +181,7 @@ abstract class XDragSourceProtocol {
long time) {
XWindowAttributes wattr = new XWindowAttributes();
try {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
targetWindow, wattr.pData);
@ -198,7 +198,7 @@ abstract class XDragSourceProtocol {
wattr.dispose();
}
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
targetWindowMask |
XConstants.StructureNotifyMask);
@ -214,7 +214,7 @@ abstract class XDragSourceProtocol {
}
protected final void finalizeDrop() {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
targetWindowMask);
XToolkit.RESTORE_XERROR_HANDLER();

@ -168,7 +168,7 @@ final class XDropTargetRegistry {
if (dest_x >= 0 && dest_y >= 0) {
XWindowAttributes wattr = new XWindowAttributes();
try {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
window, wattr.pData);
XToolkit.RESTORE_XERROR_HANDLER();
@ -222,7 +222,7 @@ final class XDropTargetRegistry {
long event_mask = 0;
XWindowAttributes wattr = new XWindowAttributes();
try {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
embedder, wattr.pData);
XToolkit.RESTORE_XERROR_HANDLER();
@ -240,7 +240,7 @@ final class XDropTargetRegistry {
}
if ((event_mask & XConstants.PropertyChangeMask) == 0) {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
event_mask | XConstants.PropertyChangeMask);
XToolkit.RESTORE_XERROR_HANDLER();
@ -394,7 +394,7 @@ final class XDropTargetRegistry {
/* Restore the original event mask for the embedder. */
if ((event_mask & XConstants.PropertyChangeMask) == 0) {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
event_mask);
XToolkit.RESTORE_XERROR_HANDLER();

@ -301,7 +301,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
try {
XWindowAttributes wattr = new XWindowAttributes();
try {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
xembed.handle, wattr.pData);

@ -386,5 +386,7 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
public void setZOrder(ComponentPeer above) {
}
public void updateGraphicsData(GraphicsConfiguration gc) {}
public boolean updateGraphicsData(GraphicsConfiguration gc) {
return false;
}
}

@ -0,0 +1,79 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.awt.X11;
public abstract class XErrorHandler {
/*
* Called under AWT lock
*/
public abstract int handleError(long display, XErrorEvent err);
/*
* Forwards all the errors to saved error handler (which was
* set before XToolkit had been initialized).
*/
public static class XBaseErrorHandler extends XErrorHandler {
@Override
public int handleError(long display, XErrorEvent err) {
return XToolkit.SAVED_ERROR_HANDLER(display, err);
}
}
/*
* Instead of validating window id, we simply call XGetWindowProperty,
* but temporary install this function as the error handler to ignore
* BadWindow error.
*/
public static class IgnoreBadWindowHandler extends XBaseErrorHandler {
@Override
public int handleError(long display, XErrorEvent err) {
if (err.get_error_code() == XConstants.BadWindow) {
return 0;
}
return super.handleError(display, err);
}
// Shared instance
private static IgnoreBadWindowHandler theInstance = new IgnoreBadWindowHandler();
public static IgnoreBadWindowHandler getInstance() {
return theInstance;
}
}
public static class VerifyChangePropertyHandler extends XBaseErrorHandler {
@Override
public int handleError(long display, XErrorEvent err) {
if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
return 0;
}
return super.handleError(display, err);
}
// Shared instance
private static IgnoreBadWindowHandler theInstance = new IgnoreBadWindowHandler();
public static IgnoreBadWindowHandler getInstance() {
return theInstance;
}
}
}

@ -29,6 +29,9 @@ package sun.awt.X11;
import java.util.Hashtable;
import sun.misc.Unsafe;
import java.util.logging.Level;
import java.util.logging.Logger;
public class XKeysym {
public static void main( String args[] ) {
@ -67,6 +70,7 @@ public class XKeysym {
static Hashtable<Integer, Long> javaKeycode2KeysymHash = new Hashtable<Integer, Long>();
static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize());
static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize());
private static Logger keyEventLog = Logger.getLogger("sun.awt.X11.kye.XKeysym");
public static char convertKeysym( long ks, int state ) {
/* First check for Latin-1 characters (1:1 mapping) */
@ -107,8 +111,15 @@ public class XKeysym {
// clearly means that caller needs a so called primary keysym.
mods ^= XConstants.ShiftMask;
}
XlibWrapper.XkbTranslateKeyCode(XToolkit.getXKBKbdDesc(), ev.get_keycode(),
long kbdDesc = XToolkit.getXKBKbdDesc();
if( kbdDesc != 0 ) {
XlibWrapper.XkbTranslateKeyCode(kbdDesc, ev.get_keycode(),
mods, XlibWrapper.iarg1, XlibWrapper.larg3);
}else{
// xkb resources already gone
keyEventLog.fine("Thread race: Toolkit shutdown before the end of a key event processing.");
return 0;
}
//XXX unconsumed modifiers?
return Native.getLong(XlibWrapper.larg3);
} finally {

@ -35,20 +35,6 @@ class XProtocol {
private Map<XAtom, XAtomList> atomToList = new HashMap<XAtom, XAtomList>();
private Map<XAtom, Long> atomToAnchor = new HashMap<XAtom, Long>();
/*
* Temporary error handler that ensures that we know if
* XChangeProperty succeeded or not.
*/
static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() {
public int handleError(long display, XErrorEvent err) {
XToolkit.XERROR_SAVE(err);
if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
return 0;
} else {
return XToolkit.SAVED_ERROR_HANDLER(display, err);
}
}
};
volatile boolean firstCheck = true;
/*
* Check that that the list of protocols specified by WM in property

@ -52,7 +52,7 @@ public class XQueryTree {
public int execute() {
return execute(null);
}
public int execute(XToolkit.XErrorHandler errorHandler) {
public int execute(XErrorHandler errorHandler) {
XToolkit.awtLock();
try {
if (isDisposed()) {

@ -81,16 +81,11 @@ class XRobotPeer implements RobotPeer {
return pixelArray;
}
public int getNumberOfButtons(){
return getNumberOfButtonsImpl();
}
private static native synchronized void setup();
private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y);
private static native synchronized void mousePressImpl(int buttons);
private static native synchronized void mouseReleaseImpl(int buttons);
private static native synchronized int getNumberOfButtonsImpl();
private static native synchronized void mouseWheelImpl(int wheelAmt);
private static native synchronized void keyPressImpl(int keycode);

@ -84,21 +84,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
//Set to true by default.
private static boolean areExtraMouseButtonsEnabled = true;
/**
* Number of buttons.
* By default it's taken from the system. If system value does not
* fit into int type range, use our own MAX_BUTTONS_SUPPORT value.
*/
private static int numberOfButtons = 0;
/* XFree standard mention 24 buttons as maximum:
* http://www.xfree86.org/current/mouse.4.html
* We workaround systems supporting more than 24 buttons.
* Otherwise, we have to use long type values as masks
* which leads to API change.
*/
private static int MAX_BUTTONS_SUPPORT = 24;
/**
* True when the x settings have been loaded.
*/
@ -149,63 +134,78 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
setBackingStoreType();
}
m_removeSourceEvents = SunToolkit.getMethod(EventQueue.class, "removeSourceEvents", new Class[] {Object.class, Boolean.TYPE}) ;
noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler"));
}
// Error handler stuff
static XErrorEvent saved_error;
static long saved_error_handler;
static XErrorHandler curErrorHandler;
// Should be called under LOCK, before releasing LOCK RESTORE_XERROR_HANDLER should be called
static void WITH_XERROR_HANDLER(XErrorHandler handler) {
//---- ERROR HANDLER CODE ----//
/*
* Error handler at the moment of XToolkit initialization
*/
private static long saved_error_handler;
/*
* XErrorEvent being handled
*/
static volatile XErrorEvent saved_error;
/*
* Current error handler or null if no error handler is set
*/
private static XErrorHandler current_error_handler;
/*
* Value of sun.awt.noisyerrorhandler system property
*/
private static boolean noisyAwtHandler;
public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
saved_error = null;
curErrorHandler = handler;
XSync();
saved_error_handler = XlibWrapper.SetToolkitErrorHandler();
current_error_handler = handler;
}
static void XERROR_SAVE(XErrorEvent event) {
saved_error = event;
public static void RESTORE_XERROR_HANDLER() {
current_error_handler = null;
}
// Should be called under LOCK
static void RESTORE_XERROR_HANDLER() {
XSync();
XlibWrapper.XSetErrorHandler(saved_error_handler);
curErrorHandler = null;
public static int SAVED_ERROR_HANDLER(long display, XErrorEvent error) {
if (saved_error_handler != 0) {
// Default XErrorHandler may just terminate the process. Don't call it.
// return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
}
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Unhandled XErrorEvent: " +
"id=" + error.get_resourceid() + ", " +
"serial=" + error.get_serial() + ", " +
"ec=" + error.get_error_code() + ", " +
"rc=" + error.get_request_code() + ", " +
"mc=" + error.get_minor_code());
}
return 0;
}
// Should be called under LOCK
static int SAVED_ERROR_HANDLER(long display, XErrorEvent error) {
return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
}
interface XErrorHandler {
int handleError(long display, XErrorEvent err);
}
static int GlobalErrorHandler(long display, long event_ptr) {
// Called from the native code when an error occurs
private static int globalErrorHandler(long display, long event_ptr) {
if (noisyAwtHandler) {
XlibWrapper.PrintXErrorEvent(display, event_ptr);
}
XErrorEvent event = new XErrorEvent(event_ptr);
saved_error = event;
try {
if (curErrorHandler != null) {
return curErrorHandler.handleError(display, event);
if (current_error_handler != null) {
return current_error_handler.handleError(display, event);
} else {
return SAVED_ERROR_HANDLER(display, event);
}
} finally {
} catch (Throwable z) {
log.log(Level.FINE, "Error in GlobalErrorHandler", z);
}
return 0;
}
/*
* Instead of validating window id, we simply call XGetWindowProperty,
* but temporary install this function as the error handler to ignore
* BadWindow error.
*/
static XErrorHandler IgnoreBadWindowHandler = new XErrorHandler() {
public int handleError(long display, XErrorEvent err) {
XERROR_SAVE(err);
if (err.get_error_code() == XConstants.BadWindow) {
return 0;
} else {
return SAVED_ERROR_HANDLER(display, err);
}
}
};
//---- END OF ERROR HANDLER CODE ----//
private native static void initIDs();
native static void waitForEvents(long nextTaskTime);
@ -302,25 +302,34 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
saved_error_handler = XlibWrapper.SetToolkitErrorHandler();
} finally {
awtUnlock();
}
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
XSystemTrayPeer peer = XSystemTrayPeer.getPeerInstance();
if (peer != null) {
peer.dispose();
}
if (xs != null) {
((XAWTXSettings)xs).dispose();
}
freeXKB();
if (log.isLoggable(Level.FINE)) {
dumpPeers();
}
public void run() {
XSystemTrayPeer peer = XSystemTrayPeer.getPeerInstance();
if (peer != null) {
peer.dispose();
}
});
if (xs != null) {
((XAWTXSettings)xs).dispose();
}
freeXKB();
if (log.isLoggable(Level.FINE)) {
dumpPeers();
}
awtLock();
try {
XlibWrapper.XSetErrorHandler(saved_error_handler);
} finally {
awtUnlock();
}
}
});
}
static String getCorrectXIDString(String val) {
@ -1434,19 +1443,26 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
desktopProperties.put("awt.multiClickInterval",
Integer.valueOf(getMultiClickTime()));
desktopProperties.put("awt.mouse.numButtons",
Integer.valueOf(getNumMouseButtons()));
Integer.valueOf(getNumberOfButtons()));
}
}
public static int getNumMouseButtons() {
/**
* This method runs through the XPointer and XExtendedPointer array.
* XExtendedPointer has priority because on some systems XPointer
* (which is assigned to the virtual pointer) reports the maximum
* capabilities of the mouse pointer (i.e. 32 physical buttons).
*/
private native synchronized int getNumberOfButtonsImpl();
@Override
public int getNumberOfButtons(){
awtLock();
try {
if (numberOfButtons == 0) {
numberOfButtons = Math.min(
XlibWrapper.XGetPointerMapping(XToolkit.getDisplay(), 0, 0),
MAX_BUTTONS_SUPPORT);
numberOfButtons = getNumberOfButtonsImpl();
}
return numberOfButtons;
return (numberOfButtons > MAX_BUTTONS_SUPPORTED)? MAX_BUTTONS_SUPPORTED : numberOfButtons;
} finally {
awtUnlock();
}
@ -2239,6 +2255,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
try {
if (awt_UseXKB_Calls && awt_XKBDescPtr != 0) {
XlibWrapper.XkbFreeKeyboard(awt_XKBDescPtr, 0xFF, true);
awt_XKBDescPtr = 0;
}
} finally {
awtUnlock();
@ -2409,8 +2426,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
return new XDesktopPeer();
}
public static native void setNoisyXErrorHandler();
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
return areExtraMouseButtonsEnabled;
}

@ -57,7 +57,7 @@ public class XTranslateCoordinates {
public int execute() {
return execute(null);
}
public int execute(XToolkit.XErrorHandler errorHandler) {
public int execute(XErrorHandler errorHandler) {
XToolkit.awtLock();
try {
if (isDisposed()) {

@ -276,7 +276,7 @@ final class XWM
winmgr_running = false;
substruct.set_event_mask(XConstants.SubstructureRedirectMask);
XToolkit.WITH_XERROR_HANDLER(DetectWMHandler);
XToolkit.WITH_XERROR_HANDLER(detectWMHandler);
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
XToolkit.getDefaultRootWindow(),
XConstants.CWEventMask,
@ -321,7 +321,7 @@ final class XWM
new WindowPropertyGetter(window, XA_ENLIGHTENMENT_COMMS, 0, 14, false,
XAtom.XA_STRING);
try {
int status = getter.execute(XToolkit.IgnoreBadWindowHandler);
int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success || getter.getData() == 0) {
return 0;
}
@ -439,7 +439,7 @@ final class XWM
new WindowPropertyGetter(wmwin, XA_DT_SM_STATE_INFO, 0, 1,
false, XA_DT_SM_STATE_INFO);
try {
status = getter2.execute(XToolkit.IgnoreBadWindowHandler);
status = getter2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success || getter2.getData() == 0) {
@ -570,21 +570,6 @@ final class XWM
return (XWM.getWMID() == XWM.COMPIZ_WM || XWM.getWMID() == XWM.LG3D_WM);
}
/*
* Temporary error handler that ensures that we know if
* XChangeProperty succeeded or not.
*/
static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() {
public int handleError(long display, XErrorEvent err) {
XToolkit.XERROR_SAVE(err);
if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
return 0;
} else {
return XToolkit.SAVED_ERROR_HANDLER(display, err);
}
}
};
/*
* Prepare IceWM check.
*
@ -617,7 +602,7 @@ final class XWM
XToolkit.awtLock();
try {
XToolkit.WITH_XERROR_HANDLER(VerifyChangePropertyHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
XlibWrapper.XChangePropertyS(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
XA_ICEWM_WINOPTHINT.getAtom(),
XA_ICEWM_WINOPTHINT.getAtom(),
@ -682,20 +667,19 @@ final class XWM
* Temporary error handler that checks if selecting for
* SubstructureRedirect failed.
*/
static boolean winmgr_running = false;
static XToolkit.XErrorHandler DetectWMHandler = new XToolkit.XErrorHandler() {
public int handleError(long display, XErrorEvent err) {
XToolkit.XERROR_SAVE(err);
if (err.get_request_code() == XProtocolConstants.X_ChangeWindowAttributes
&& err.get_error_code() == XConstants.BadAccess)
{
winmgr_running = true;
return 0;
} else {
return XToolkit.SAVED_ERROR_HANDLER(display, err);
}
private static boolean winmgr_running = false;
private static XErrorHandler detectWMHandler = new XErrorHandler.XBaseErrorHandler() {
@Override
public int handleError(long display, XErrorEvent err) {
if ((err.get_request_code() == XProtocolConstants.X_ChangeWindowAttributes) &&
(err.get_error_code() == XConstants.BadAccess))
{
winmgr_running = true;
return 0;
}
};
return super.handleError(display, err);
}
};
/*
* Make an educated guess about running window manager.

@ -34,74 +34,68 @@ import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
class XWarningWindow extends XWindow {
private final static int showingDelay = 330;
private final static int hidingDelay = 2000;
private final static int SHOWING_DELAY = 330;
private final static int HIDING_DELAY = 2000;
private final Window ownerWindow;
private WeakReference<XWindowPeer> ownerPeer;
public final Window getOwnerWindow() {
return ownerWindow;
}
private long parentWindow;
private final static String OWNER = "OWNER";
private static XIconInfo[][] icons;
private InfoWindow.Tooltip tooltip;
private static synchronized XIconInfo getSecurityIconInfo(int size, int num) {
if (icons == null) {
icons = new XIconInfo[4][3];
if (XlibWrapper.dataModel == 32) {
icons[0][0] = new XIconInfo(XAWTIcon32_security_icon_bw16_png.security_icon_bw16_png);
icons[0][1] = new XIconInfo(XAWTIcon32_security_icon_interim16_png.security_icon_interim16_png);
icons[0][2] = new XIconInfo(XAWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png);
icons[1][0] = new XIconInfo(XAWTIcon32_security_icon_bw24_png.security_icon_bw24_png);
icons[1][1] = new XIconInfo(XAWTIcon32_security_icon_interim24_png.security_icon_interim24_png);
icons[1][2] = new XIconInfo(XAWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png);
icons[2][0] = new XIconInfo(XAWTIcon32_security_icon_bw32_png.security_icon_bw32_png);
icons[2][1] = new XIconInfo(XAWTIcon32_security_icon_interim32_png.security_icon_interim32_png);
icons[2][2] = new XIconInfo(XAWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png);
icons[3][0] = new XIconInfo(XAWTIcon32_security_icon_bw48_png.security_icon_bw48_png);
icons[3][1] = new XIconInfo(XAWTIcon32_security_icon_interim48_png.security_icon_interim48_png);
icons[3][2] = new XIconInfo(XAWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png);
} else {
icons[0][0] = new XIconInfo(XAWTIcon64_security_icon_bw16_png.security_icon_bw16_png);
icons[0][1] = new XIconInfo(XAWTIcon64_security_icon_interim16_png.security_icon_interim16_png);
icons[0][2] = new XIconInfo(XAWTIcon64_security_icon_yellow16_png.security_icon_yellow16_png);
icons[1][0] = new XIconInfo(XAWTIcon64_security_icon_bw24_png.security_icon_bw24_png);
icons[1][1] = new XIconInfo(XAWTIcon64_security_icon_interim24_png.security_icon_interim24_png);
icons[1][2] = new XIconInfo(XAWTIcon64_security_icon_yellow24_png.security_icon_yellow24_png);
icons[2][0] = new XIconInfo(XAWTIcon64_security_icon_bw32_png.security_icon_bw32_png);
icons[2][1] = new XIconInfo(XAWTIcon64_security_icon_interim32_png.security_icon_interim32_png);
icons[2][2] = new XIconInfo(XAWTIcon64_security_icon_yellow32_png.security_icon_yellow32_png);
icons[3][0] = new XIconInfo(XAWTIcon64_security_icon_bw48_png.security_icon_bw48_png);
icons[3][1] = new XIconInfo(XAWTIcon64_security_icon_interim48_png.security_icon_interim48_png);
icons[3][2] = new XIconInfo(XAWTIcon64_security_icon_yellow48_png.security_icon_yellow48_png);
/**
* Animation stage.
*/
private volatile int currentIcon = 0;
/* -1 - uninitialized.
* 0 - 16x16
* 1 - 24x24
* 2 - 32x32
* 3 - 48x48
*/
private int currentSize = -1;
private static XIconInfo[][] icons;
private static XIconInfo getSecurityIconInfo(int size, int num) {
synchronized (XWarningWindow.class) {
if (icons == null) {
icons = new XIconInfo[4][3];
if (XlibWrapper.dataModel == 32) {
icons[0][0] = new XIconInfo(XAWTIcon32_security_icon_bw16_png.security_icon_bw16_png);
icons[0][1] = new XIconInfo(XAWTIcon32_security_icon_interim16_png.security_icon_interim16_png);
icons[0][2] = new XIconInfo(XAWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png);
icons[1][0] = new XIconInfo(XAWTIcon32_security_icon_bw24_png.security_icon_bw24_png);
icons[1][1] = new XIconInfo(XAWTIcon32_security_icon_interim24_png.security_icon_interim24_png);
icons[1][2] = new XIconInfo(XAWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png);
icons[2][0] = new XIconInfo(XAWTIcon32_security_icon_bw32_png.security_icon_bw32_png);
icons[2][1] = new XIconInfo(XAWTIcon32_security_icon_interim32_png.security_icon_interim32_png);
icons[2][2] = new XIconInfo(XAWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png);
icons[3][0] = new XIconInfo(XAWTIcon32_security_icon_bw48_png.security_icon_bw48_png);
icons[3][1] = new XIconInfo(XAWTIcon32_security_icon_interim48_png.security_icon_interim48_png);
icons[3][2] = new XIconInfo(XAWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png);
} else {
icons[0][0] = new XIconInfo(XAWTIcon64_security_icon_bw16_png.security_icon_bw16_png);
icons[0][1] = new XIconInfo(XAWTIcon64_security_icon_interim16_png.security_icon_interim16_png);
icons[0][2] = new XIconInfo(XAWTIcon64_security_icon_yellow16_png.security_icon_yellow16_png);
icons[1][0] = new XIconInfo(XAWTIcon64_security_icon_bw24_png.security_icon_bw24_png);
icons[1][1] = new XIconInfo(XAWTIcon64_security_icon_interim24_png.security_icon_interim24_png);
icons[1][2] = new XIconInfo(XAWTIcon64_security_icon_yellow24_png.security_icon_yellow24_png);
icons[2][0] = new XIconInfo(XAWTIcon64_security_icon_bw32_png.security_icon_bw32_png);
icons[2][1] = new XIconInfo(XAWTIcon64_security_icon_interim32_png.security_icon_interim32_png);
icons[2][2] = new XIconInfo(XAWTIcon64_security_icon_yellow32_png.security_icon_yellow32_png);
icons[3][0] = new XIconInfo(XAWTIcon64_security_icon_bw48_png.security_icon_bw48_png);
icons[3][1] = new XIconInfo(XAWTIcon64_security_icon_interim48_png.security_icon_interim48_png);
icons[3][2] = new XIconInfo(XAWTIcon64_security_icon_yellow48_png.security_icon_yellow48_png);
}
}
}
final int sizeIndex = size % icons.length;
return icons[sizeIndex][num % icons[sizeIndex].length];
}
private volatile int currentIcon = 0;
/* -1 - uninitialized yet
* 0 - 16x16
* 1 - 24x24
* 2 - 32x32
* 3 - 48x48
*/
private volatile int currentSize = -1;
/** Indicates whether the shape of the window must be updated
*/
private volatile boolean sizeUpdated = true;
private synchronized boolean updateIconSize() {
int newSize = currentSize;
private void updateIconSize() {
int newSize = -1;
if (ownerWindow != null) {
Insets insets = ownerWindow.getInsets();
@ -117,14 +111,32 @@ class XWarningWindow extends XWindow {
newSize = 3;
}
}
if (newSize != currentSize) {
currentSize = newSize;
sizeUpdated = true;
// Make sure we have a valid size
if (newSize == -1) {
newSize = 0;
}
// Note: this is not the most wise solution to use awtLock here,
// this should have been sync'ed with the stateLock. However,
// the awtLock must be taken first (see XBaseWindow.getStateLock()),
// and we need the awtLock anyway to update the shape of the icon.
// So it's easier to use just one lock instead.
XToolkit.awtLock();
try {
if (newSize != currentSize) {
currentSize = newSize;
XIconInfo ico = getSecurityIconInfo(currentSize, 0);
XlibWrapper.SetBitmapShape(XToolkit.getDisplay(), getWindow(),
ico.getWidth(), ico.getHeight(), ico.getIntData());
AWTAccessor.getWindowAccessor().setSecurityWarningSize(
ownerWindow, ico.getWidth(), ico.getHeight());
}
} finally {
XToolkit.awtUnlock();
}
return sizeUpdated;
}
private synchronized XIconInfo getSecurityIconInfo() {
private XIconInfo getSecurityIconInfo() {
updateIconSize();
return getSecurityIconInfo(currentSize, currentIcon);
}
@ -183,28 +195,6 @@ class XWarningWindow extends XWindow {
}
}
private void updateWarningWindowBounds() {
XWindowPeer peer = ownerPeer.get();
if (peer != null) {
synchronized (this) {
if (updateIconSize()) {
XIconInfo ico = getSecurityIconInfo();
XToolkit.awtLock();
try {
XlibWrapper.SetBitmapShape(XToolkit.getDisplay(), getWindow(),
ico.getWidth(), ico.getHeight(), ico.getIntData());
} finally {
XToolkit.awtUnlock();
}
sizeUpdated = false;
AWTAccessor.getWindowAccessor().setSecurityWarningSize(
ownerWindow, ico.getWidth(), ico.getHeight());
}
}
peer.repositionSecurityWarning();
}
}
/**
* @param x,y,w,h coordinates of the untrusted window
*/
@ -376,25 +366,22 @@ class XWarningWindow extends XWindow {
private final Runnable showingTask = new Runnable() {
public void run() {
new Thread() {
public void run() {
if (!isVisible()) {
xSetVisible(true);
updateWarningWindowBounds();
}
repaint();
if (currentIcon > 0) {
currentIcon--;
XToolkit.schedule(showingTask, showingDelay);
}
}}.start();
if (!isVisible()) {
xSetVisible(true);
updateIconSize();
XWindowPeer peer = ownerPeer.get();
if (peer != null) {
peer.repositionSecurityWarning();
}
}
repaint();
if (currentIcon > 0) {
currentIcon--;
XToolkit.schedule(showingTask, SHOWING_DELAY);
}
}
};
public void setSecurityWarningVisible(boolean visible) {
setSecurityWarningVisible(visible, true);
}
public void setSecurityWarningVisible(boolean visible, boolean doSchedule) {
if (visible) {
XToolkit.remove(hidingTask);
@ -416,7 +403,7 @@ class XWarningWindow extends XWindow {
return;
}
if (doSchedule) {
XToolkit.schedule(hidingTask, hidingDelay);
XToolkit.schedule(hidingTask, HIDING_DELAY);
} else {
hidingTask.run();
}

@ -677,6 +677,14 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
int button=0;
boolean wheel_mouse = false;
int lbutton = xbe.get_button();
/*
* Ignore the buttons above 20 due to the bit limit for
* InputEvent.BUTTON_DOWN_MASK.
* One more bit is reserved for FIRST_HIGH_BIT.
*/
if (lbutton > SunToolkit.MAX_BUTTONS_SUPPORTED) {
return;
}
int type = xev.get_type();
when = xbe.get_time();
long jWhen = XToolkit.nowMillisUTC_offset(when);
@ -795,8 +803,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
//this doesn't work for extra buttons because Xsystem is sending state==0 for every extra button event.
// we can't correct it in MouseEvent class as we done it with modifiers, because exact type (DRAG|MOVE)
// should be passed from XWindow.
//TODO: eliminate it with some other value obtained w/o AWTLock.
for (int i = 0; i < XToolkit.getNumMouseButtons(); i++){
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
for (int i = 0; i < buttonsNumber; i++){
// TODO : here is the bug in WM: extra buttons doesn't have state!=0 as they should.
if ((i != 4) && (i != 5)) {
mouseKeyState = mouseKeyState | (xme.get_state() & XConstants.buttonsMask[i]);
@ -1343,18 +1352,23 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
setSizeHints(flags, x, y, width, height);
}
void validateSurface() {
void validateSurface() {
if ((width != oldWidth) || (height != oldHeight)) {
SurfaceData oldData = surfaceData;
if (oldData != null) {
surfaceData = graphicsConfig.createSurfaceData(this);
oldData.invalidate();
}
doValidateSurface();
oldWidth = width;
oldHeight = height;
}
}
final void doValidateSurface() {
SurfaceData oldData = surfaceData;
if (oldData != null) {
surfaceData = graphicsConfig.createSurfaceData(this);
oldData.invalidate();
}
}
public SurfaceData getSurfaceData() {
return surfaceData;
}

@ -1108,7 +1108,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
}
warningWindow.setSecurityWarningVisible(show);
warningWindow.setSecurityWarningVisible(show, true);
}
boolean isOverrideRedirect() {
@ -1894,7 +1894,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
if (isGrabbed()) {
boolean dragging = false;
for (int i = 0; i<XToolkit.getNumMouseButtons(); i++){
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
for (int i = 0; i < buttonsNumber; i++){
// here is the bug in WM: extra buttons doesn't have state!=0 as they should.
if ((i != 4) && (i != 5)){
dragging = dragging || ((xme.get_state() & XConstants.buttonsMask[i]) != 0);
@ -1940,6 +1942,15 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
public void handleButtonPressRelease(XEvent xev) {
XButtonEvent xbe = xev.get_xbutton();
/*
* Ignore the buttons above 20 due to the bit limit for
* InputEvent.BUTTON_DOWN_MASK.
* One more bit is reserved for FIRST_HIGH_BIT.
*/
if (xbe.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
return;
}
if (grabLog.isLoggable(Level.FINE)) {
grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2} ({3}, {4}, {5}x{6})",
new Object[] {xbe, isGrabbed(), containsGlobal(xbe.get_x_root(), xbe.get_y_root()), getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()});
@ -2058,7 +2069,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
@Override
public void updateWindow(BufferedImage backBuffer) {
public void updateWindow() {
// no-op
}
}

@ -149,7 +149,7 @@ public class XlibUtil
new XTranslateCoordinates(src, dst, p.x, p.y);
try
{
int status = xtc.execute(XToolkit.IgnoreBadWindowHandler);
int status = xtc.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if ((status != 0) &&
((XToolkit.saved_error == null) ||
(XToolkit.saved_error.get_error_code() == XConstants.Success)))
@ -306,7 +306,7 @@ public class XlibUtil
XWM.XA_WM_STATE);
try
{
wpg.execute(XToolkit.IgnoreBadWindowHandler);
wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (wpg.getActualType() == XWM.XA_WM_STATE.getAtom())
{
return true;
@ -345,7 +345,7 @@ public class XlibUtil
XWindowAttributes wattr = new XWindowAttributes();
try
{
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
window, wattr.pData);
XToolkit.RESTORE_XERROR_HANDLER();

@ -646,4 +646,6 @@ static native String XSetLocaleModifiers(String modifier_list);
String javaVersion = XToolkit.getSystemProperty("java.version");
return javaVersion != null && javaVersion.contains("internal");
}
static native void PrintXErrorEvent(long display, long event_ptr);
}

@ -186,6 +186,15 @@ XEvent.xerror 0
XEvent.xkeymap 0
XEvent.pad 0
XEvent 192
XRenderDirectFormat.red 0
XRenderDirectFormat.redMask 2
XRenderDirectFormat.green 4
XRenderDirectFormat.greenMask 6
XRenderDirectFormat.blue 8
XRenderDirectFormat.blueMask 10
XRenderDirectFormat.alpha 12
XRenderDirectFormat.alphaMask 14
XRenderDirectFormat 16
ColorData.awt_Colors 0
ColorData.awt_numICMcolors 8
ColorData.awt_icmLUT 16
@ -440,6 +449,12 @@ XSetWindowAttributes.override_redirect 88
XSetWindowAttributes.colormap 96
XSetWindowAttributes.cursor 104
XSetWindowAttributes 112
XRenderPictFormat.id 0
XRenderPictFormat.type 8
XRenderPictFormat.depth 12
XRenderPictFormat.direct 16
XRenderPictFormat.colormap 32
XRenderPictFormat 40
XReparentEvent.type 0
XReparentEvent.serial 8
XReparentEvent.send_event 16
@ -985,7 +1000,8 @@ AwtGraphicsConfigData.pixelStride 136
AwtGraphicsConfigData.color_data 144
AwtGraphicsConfigData.glxInfo 152
AwtGraphicsConfigData.isTranslucencySupported 160
AwtGraphicsConfigData 168
AwtGraphicsConfigData.renderPictFormat 168
AwtGraphicsConfigData 208
XColor.pixel 0
XColor.red 8
XColor.green 10

@ -245,6 +245,21 @@ XVisualInfo
blue_mask long
colormap_size int
bits_per_rgb int
XRenderDirectFormat
red short
redMask short
green short
greenMask short
blue short
blueMask short
alpha short
alphaMask short
XRenderPictFormat
id long
type int
depth int
direct struct XRenderDirectFormat
colormap long
XIMHotKeyTrigger
keysym long
modifier int
@ -751,6 +766,7 @@ AwtGraphicsConfigData
color_data pointer ColorData
glxInfo pointer
isTranslucencySupported int
renderPictFormat struct XRenderPictFormat
AwtScreenData
numConfigs int

@ -67,6 +67,9 @@ tojava package sun.awt.X11;
tojava import java.util.Hashtable;
tojava import sun.misc.Unsafe;
tojava
tojava import java.util.logging.Level;
tojava import java.util.logging.Logger;
tojava
tojava public class XKeysym {
tojava
tojava public static void main( String args[] ) {
@ -105,6 +108,7 @@ tojava // Another use for reverse lookup: query keyboard state, for some key
tojava static Hashtable<Integer, Long> javaKeycode2KeysymHash = new Hashtable<Integer, Long>();
tojava static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize());
tojava static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize());
tojava private static Logger keyEventLog = Logger.getLogger("sun.awt.X11.kye.XKeysym");
tojava public static char convertKeysym( long ks, int state ) {
tojava
tojava /* First check for Latin-1 characters (1:1 mapping) */
@ -145,8 +149,15 @@ tojava // and don't want to speculate. But this particular case
tojava // clearly means that caller needs a so called primary keysym.
tojava mods ^= XConstants.ShiftMask;
tojava }
tojava XlibWrapper.XkbTranslateKeyCode(XToolkit.getXKBKbdDesc(), ev.get_keycode(),
tojava long kbdDesc = XToolkit.getXKBKbdDesc();
tojava if( kbdDesc != 0 ) {
tojava XlibWrapper.XkbTranslateKeyCode(kbdDesc, ev.get_keycode(),
tojava mods, XlibWrapper.iarg1, XlibWrapper.larg3);
tojava }else{
tojava // xkb resources already gone
tojava keyEventLog.fine("Thread race: Toolkit shutdown before the end of a key event processing.");
tojava return 0;
tojava }
tojava //XXX unconsumed modifiers?
tojava return Native.getLong(XlibWrapper.larg3);
tojava } finally {

@ -37,7 +37,10 @@ import java.awt.ImageCapabilities;
import java.awt.Transparency;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.color.ColorSpace;
import java.awt.image.ComponentColorModel;
import java.awt.image.DirectColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
import java.awt.geom.AffineTransform;
@ -230,6 +233,22 @@ public class X11GraphicsConfig extends GraphicsConfiguration
}
}
public static DirectColorModel createDCM32(int rMask, int gMask, int bMask,
int aMask, boolean aPre) {
return new DirectColorModel(
ColorSpace.getInstance(ColorSpace.CS_sRGB),
32, rMask, gMask, bMask, aMask, aPre, DataBuffer.TYPE_INT);
}
public static ComponentColorModel createABGRCCM() {
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
int[] nBits = {8, 8, 8, 8};
int[] bOffs = {3, 2, 1, 0};
return new ComponentColorModel(cs, nBits, true, true,
Transparency.TRANSLUCENT,
DataBuffer.TYPE_BYTE);
}
/**
* Returns the default Transform for this configuration. This
* Transform is typically the Identity transform for most normal

@ -1,5 +1,5 @@
/*
* Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -624,7 +624,6 @@ public class MToolkit extends UNIXToolkit implements Runnable {
}
private native int getMulticlickTime();
private native int getNumMouseButtons();
protected void initializeDesktopProperties() {
desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50));
@ -643,7 +642,7 @@ public class MToolkit extends UNIXToolkit implements Runnable {
desktopProperties.put("awt.multiClickInterval",
Integer.valueOf(getMulticlickTime()));
desktopProperties.put("awt.mouse.numButtons",
Integer.valueOf(getNumMouseButtons()));
Integer.valueOf(getNumberOfButtons()));
}
}

@ -70,6 +70,10 @@ public class X11PMBlitBgLoops extends BlitBg {
X11SurfaceData.UShort565RgbX11),
new X11PMBlitBgLoops(X11SurfaceData.UShortIndexedX11_BM,
X11SurfaceData.UShortIndexedX11),
new X11PMBlitBgLoops(X11SurfaceData.IntRgbX11_BM,
X11SurfaceData.IntArgbPreX11),
new X11PMBlitBgLoops(X11SurfaceData.IntBgrX11_BM,
X11SurfaceData.FourByteAbgrPreX11),
};
GraphicsPrimitiveMgr.register(primitives);
}

@ -95,6 +95,22 @@ public class X11PMBlitLoops extends Blit {
new X11PMBlitLoops(X11SurfaceData.UShortIndexedX11_BM,
X11SurfaceData.UShortIndexedX11, true),
new X11PMBlitLoops(X11SurfaceData.IntRgbX11,
X11SurfaceData.IntArgbPreX11, true),
new X11PMBlitLoops(X11SurfaceData.IntRgbX11,
X11SurfaceData.IntArgbPreX11, false),
new X11PMBlitLoops(X11SurfaceData.IntRgbX11_BM,
X11SurfaceData.IntArgbPreX11, true),
new X11PMBlitLoops(X11SurfaceData.IntBgrX11,
X11SurfaceData.FourByteAbgrPreX11, true),
new X11PMBlitLoops(X11SurfaceData.IntBgrX11,
X11SurfaceData.FourByteAbgrPreX11, false),
new X11PMBlitLoops(X11SurfaceData.IntBgrX11_BM,
X11SurfaceData.FourByteAbgrPreX11, true),
// delegate loops
new DelegateBlitLoop(X11SurfaceData.IntBgrX11_BM,
X11SurfaceData.IntBgrX11),

@ -81,6 +81,13 @@ public abstract class X11SurfaceData extends SurfaceData {
DESC_INT_BGR_X11 = "Integer BGR Pixmap";
public static final String
DESC_INT_RGB_X11 = "Integer RGB Pixmap";
public static final String
DESC_4BYTE_ABGR_PRE_X11 = "4 byte ABGR Pixmap with pre-multplied alpha";
public static final String
DESC_INT_ARGB_PRE_X11 = "Integer ARGB Pixmap with pre-multiplied " +
"alpha";
public static final String
DESC_BYTE_IND_OPQ_X11 = "Byte Indexed Opaque Pixmap";
@ -133,6 +140,11 @@ public abstract class X11SurfaceData extends SurfaceData {
public static final SurfaceType IntRgbX11 =
SurfaceType.IntRgb.deriveSubType(DESC_INT_RGB_X11);
public static final SurfaceType FourByteAbgrPreX11 =
SurfaceType.FourByteAbgrPre.deriveSubType(DESC_4BYTE_ABGR_PRE_X11);
public static final SurfaceType IntArgbPreX11 =
SurfaceType.IntArgbPre.deriveSubType(DESC_INT_ARGB_PRE_X11);
public static final SurfaceType ThreeByteRgbX11 =
SurfaceType.ThreeByteRgb.deriveSubType(DESC_3BYTE_RGB_X11);
public static final SurfaceType ThreeByteBgrX11 =
@ -413,7 +425,7 @@ public abstract class X11SurfaceData extends SurfaceData {
int transparency)
{
return new X11PixmapSurfaceData(gc, width, height, image,
getSurfaceType(gc, transparency),
getSurfaceType(gc, transparency, true),
cm, drawable, transparency);
}
@ -497,6 +509,13 @@ public abstract class X11SurfaceData extends SurfaceData {
public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
int transparency)
{
return getSurfaceType(gc, transparency, false);
}
public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
int transparency,
boolean pixmapSurface)
{
boolean transparent = (transparency == Transparency.BITMASK);
SurfaceType sType;
@ -524,11 +543,21 @@ public abstract class X11SurfaceData extends SurfaceData {
// Fall through for 32 bit case
case 32:
if (cm instanceof DirectColorModel) {
if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
sType = transparent ? X11SurfaceData.IntRgbX11_BM : X11SurfaceData.IntRgbX11;
if (((SunToolkit)java.awt.Toolkit.getDefaultToolkit()
).isTranslucencyCapable(gc) && !pixmapSurface)
{
sType = X11SurfaceData.IntArgbPreX11;
} else {
sType = transparent ? X11SurfaceData.IntBgrX11_BM : X11SurfaceData.IntBgrX11;
if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
sType = transparent ? X11SurfaceData.IntRgbX11_BM :
X11SurfaceData.IntRgbX11;
} else {
sType = transparent ? X11SurfaceData.IntBgrX11_BM :
X11SurfaceData.IntBgrX11;
}
}
} else if (cm instanceof ComponentColorModel) {
sType = X11SurfaceData.FourByteAbgrPreX11;
} else {
throw new sun.java2d.InvalidPipeException("Unsupported bit " +

@ -886,6 +886,27 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data)
#define blue(v) (((v) >> 0) & 0xFF)
#ifndef HEADLESS
jobject getColorSpace(JNIEnv* env, jint csID) {
jclass clazz;
jobject cspaceL;
jmethodID mid;
clazz = (*env)->FindClass(env,"java/awt/color/ColorSpace");
mid = (*env)->GetStaticMethodID(env, clazz, "getInstance",
"(I)Ljava/awt/color/ColorSpace;");
if (mid == NULL) {
return NULL;
}
/* SECURITY: This is safe, because static methods cannot
* be overridden, and this method does not invoke
* client code
*/
return (*env)->CallStaticObjectMethod(env, clazz, mid, csID);
}
jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData)
{
jobject awt_colormodel = NULL;
@ -899,21 +920,61 @@ jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData)
(aData->awt_depth >= 15))
{
clazz = (*env)->FindClass(env,"java/awt/image/DirectColorModel");
if (!aData->isTranslucencySupported) {
mid = (*env)->GetMethodID(env,clazz,"<init>","(IIIII)V");
mid = (*env)->GetMethodID(env,clazz,"<init>","(IIIII)V");
if (mid == NULL) {
(*env)->PopLocalFrame(env, 0);
return NULL;
if (mid == NULL) {
(*env)->PopLocalFrame(env, 0);
return NULL;
}
awt_colormodel = (*env)->NewObject(env,clazz, mid,
aData->awt_visInfo.depth,
aData->awt_visInfo.red_mask,
aData->awt_visInfo.green_mask,
aData->awt_visInfo.blue_mask,
0);
} else {
clazz = (*env)->FindClass(env,"sun/awt/X11GraphicsConfig");
if (clazz == NULL) {
(*env)->PopLocalFrame(env, 0);
return NULL;
}
if (aData->renderPictFormat.direct.red == 16) {
mid = (*env)->GetStaticMethodID( env,clazz,"createDCM32",
"(IIIIZ)Ljava/awt/image/DirectColorModel;");
if (mid == NULL) {
(*env)->PopLocalFrame(env, 0);
return NULL;
}
awt_colormodel = (*env)->CallStaticObjectMethod(
env,clazz, mid,
aData->renderPictFormat.direct.redMask
<< aData->renderPictFormat.direct.red,
aData->renderPictFormat.direct.greenMask
<< aData->renderPictFormat.direct.green,
aData->renderPictFormat.direct.blueMask
<< aData->renderPictFormat.direct.blue,
aData->renderPictFormat.direct.alphaMask
<< aData->renderPictFormat.direct.alpha,
JNI_TRUE);
} else {
mid = (*env)->GetStaticMethodID( env,clazz,"createABGRCCM",
"()Ljava/awt/image/ComponentColorModel;");
if (mid == NULL) {
(*env)->PopLocalFrame(env, 0);
return NULL;
}
awt_colormodel = (*env)->CallStaticObjectMethod(
env,clazz, mid);
}
}
awt_colormodel = (*env)->NewObject(env,clazz, mid,
aData->awt_visInfo.depth,
aData->awt_visInfo.red_mask,
aData->awt_visInfo.green_mask,
aData->awt_visInfo.blue_mask,
0);
if(awt_colormodel == NULL)
{
(*env)->PopLocalFrame(env, 0);
@ -923,25 +984,13 @@ jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData)
}
else if (aData->awt_visInfo.class == StaticGray &&
aData->awt_num_colors == 256) {
jclass clazz1;
jobject cspace = NULL;
jint bits[1];
jintArray bitsArray;
jboolean falseboolean = JNI_FALSE;
clazz1 = (*env)->FindClass(env,"java/awt/color/ColorSpace");
mid = (*env)->GetStaticMethodID(env, clazz1, "getInstance",
"(I)Ljava/awt/color/ColorSpace;");
if (mid == NULL) {
(*env)->PopLocalFrame(env, 0);
return NULL;
}
/* SECURITY: This is safe, because static methods cannot
* be overridden, and this method does not invoke
* client code
*/
cspace = (*env)->CallStaticObjectMethod(env, clazz1, mid,
java_awt_color_ColorSpace_CS_GRAY);
cspace = getColorSpace(env, java_awt_color_ColorSpace_CS_GRAY);
if (cspace == NULL) {
(*env)->PopLocalFrame(env, 0);
return NULL;

@ -175,42 +175,11 @@ Java_sun_awt_X11GraphicsDevice_initIDs (JNIEnv *env, jclass cls)
}
#ifndef HEADLESS
/*
* error handlers
* XIOErrorHandler
*/
int
xerror_handler(Display * disp, XErrorEvent * err)
{
/* #ifdef DEBUG */
char msg[128];
char buf[128];
char *ev = getenv("NOISY_AWT");
if (!ev || !ev[0])
return 0;
XGetErrorText(disp, err->error_code, msg, sizeof(msg));
jio_fprintf(stderr, "Xerror %s, XID %x, ser# %d\n", msg, err->resourceid, err->serial);
jio_snprintf(buf, sizeof(buf), "%d", err->request_code);
XGetErrorDatabaseText(disp, "XRequest", buf, "Unknown", msg, sizeof(msg));
jio_fprintf(stderr, "Major opcode %d (%s)\n", err->request_code, msg);
if (err->request_code > 128) {
jio_fprintf(stderr, "Minor opcode %d\n", err->minor_code);
}
if (awtLockInited) {
/*SignalError(lockedee->lastpc, lockedee, "fp/ade/gui/GUIException", msg); */
}
if (strcasecmp(ev, "abort") == 0) {
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
(*env)->FatalError(env, "xerror_handler abort");
}
/* #endif */
return 0;
}
static int
xioerror_handler(Display * disp)
static int xioerror_handler(Display *disp)
{
if (awtLockInited) {
if (errno == EPIPE) {
@ -354,48 +323,6 @@ makeDefaultConfig(JNIEnv *env, int screen) {
return NULL;
}
/* Note: until we include the <X11/extensions/Xrender.h> explicitly
* we have to define a couple of things ourselves.
*/
typedef unsigned long PictFormat;
#define PictTypeIndexed 0
#define PictTypeDirect 1
typedef struct {
short red;
short redMask;
short green;
short greenMask;
short blue;
short blueMask;
short alpha;
short alphaMask;
} XRenderDirectFormat;
typedef struct {
PictFormat id;
int type;
int depth;
XRenderDirectFormat direct;
Colormap colormap;
} XRenderPictFormat;
#define PictFormatID (1 << 0)
#define PictFormatType (1 << 1)
#define PictFormatDepth (1 << 2)
#define PictFormatRed (1 << 3)
#define PictFormatRedMask (1 << 4)
#define PictFormatGreen (1 << 5)
#define PictFormatGreenMask (1 << 6)
#define PictFormatBlue (1 << 7)
#define PictFormatBlueMask (1 << 8)
#define PictFormatAlpha (1 << 9)
#define PictFormatAlphaMask (1 << 10)
#define PictFormatColormap (1 << 11)
typedef XRenderPictFormat *
XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
static void
getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
@ -535,6 +462,8 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
format->direct.alphaMask)
{
graphicsConfigs [ind]->isTranslucencySupported = 1;
memcpy(&graphicsConfigs [ind]->renderPictFormat, format,
sizeof(*format));
}
}
}
@ -886,7 +815,6 @@ awt_init_Display(JNIEnv *env, jobject this)
return NULL;
}
XSetErrorHandler(xerror_handler);
XSetIOErrorHandler(xioerror_handler);
/* set awt_numScreens, and whether or not we're using Xinerama */

@ -1458,7 +1458,6 @@ static void CommitStringCallback(XIC ic, XPointer client_data, XPointer call_dat
}
static void OpenXIMCallback(Display *display, XPointer client_data, XPointer call_data) {
extern int xerror_handler();
XIMCallback ximCallback;
X11im = XOpenIM(display, NULL, NULL, NULL);
@ -1469,13 +1468,6 @@ static void OpenXIMCallback(Display *display, XPointer client_data, XPointer cal
ximCallback.callback = (XIMProc)DestroyXIMCallback;
ximCallback.client_data = NULL;
XSetIMValues(X11im, XNDestroyCallback, &ximCallback, NULL);
/* Workaround for Solaris 2.6 bug 4097754. We're affected by this problem
* because Motif also calls XOpenIM for us. Re-registering the error handler
* that MToolkit has registered already after calling XOpenIM avoids the
* problem.
*/
XSetErrorHandler(xerror_handler);
}
static void DestroyXIMCallback(XIM im, XPointer client_data, XPointer call_data) {

@ -1926,26 +1926,6 @@ processOneEvent(XtInputMask iMask) {
XtAppProcessEvent(awt_appContext, iMask & ~XtIMXEvent);
}
/*
** Bug #4361799: Forte4J sometimes crashes on Solaris:
** There is an underlying bug in Selection.c in Xt lib.
** The routine HandleSelectionEvents, can call EndProtectedSection()
** more than StartProtectedSection(), and then EndProtectedSection
** will restore the default XError handler. As a result awt's
** XError handler gets removed and we later crash on an XError.
**
** This happens when we call XtAppProcessEvent with event type 1e
** (SelectionRequest) when running two copies of Forte
**
** XSetErrorHandler can safely be called repeatedly, so we are
** fixing this with the sledgehammer, and resetting our XError
** handler every time through the loop:
*/
{
extern int32_t xerror_handler();
XSetErrorHandler(xerror_handler);
}
} /* processOneEvent() */
/*
@ -3186,21 +3166,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getMulticlickTime
return awt_multiclick_time;
}
/*
* Class: sun_awt_motif_MToolkit
* Method: getNumMouseButtons
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getNumMouseButtons
(JNIEnv *env, jobject this)
{
jint res = 0;
AWT_LOCK();
res = XGetPointerMapping(awt_display, NULL, 0);
AWT_UNLOCK();
return res;
}
/*
* Class: sun_awt_motif_MToolkit
* Method: loadXSettings

@ -51,9 +51,8 @@
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
// 2 would be more correct, however that's how Robot originally worked
// and tests start to fail if this value is changed
static int32_t num_buttons = 3;
extern int32_t getNumButtons();
static jint * masks;
static int32_t isXTestAvailable() {
@ -90,46 +89,6 @@ static int32_t isXTestAvailable() {
return isXTestAvailable;
}
static void getNumButtons() {
int32_t major_opcode, first_event, first_error;
int32_t xinputAvailable;
int32_t numDevices, devIdx, clsIdx;
XDeviceInfo* devices;
XDeviceInfo* aDevice;
XButtonInfo* bInfo;
/* 4700242:
* If XTest is asked to press a non-existant mouse button
* (i.e. press Button3 on a system configured with a 2-button mouse),
* then a crash may happen. To avoid this, we use the XInput
* extension to query for the number of buttons on the XPointer, and check
* before calling XTestFakeButtonEvent().
*/
xinputAvailable = XQueryExtension(awt_display, INAME, &major_opcode, &first_event, &first_error);
DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XINPUT) returns major_opcode = %d, first_event = %d, first_error = %d",
major_opcode, first_event, first_error);
if (xinputAvailable) {
devices = XListInputDevices(awt_display, &numDevices);
for (devIdx = 0; devIdx < numDevices; devIdx++) {
aDevice = &(devices[devIdx]);
if (aDevice->use == IsXPointer) {
for (clsIdx = 0; clsIdx < aDevice->num_classes; clsIdx++) {
if (aDevice->inputclassinfo[clsIdx].class == ButtonClass) {
bInfo = (XButtonInfo*)(&(aDevice->inputclassinfo[clsIdx]));
num_buttons = bInfo->num_buttons;
DTRACE_PRINTLN1("RobotPeer: XPointer has %d buttons", num_buttons);
break;
}
}
break;
}
}
XFreeDeviceList(devices);
}
else {
DTRACE_PRINTLN1("RobotPeer: XINPUT extension is unavailable, assuming %d mouse buttons", num_buttons);
}
}
static XImage *getWindowImage(Display * display, Window window,
int32_t x, int32_t y,
@ -241,17 +200,10 @@ Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls) {
return;
}
getNumButtons();
finally:
AWT_UNLOCK();
}
JNIEXPORT jint JNICALL
Java_sun_awt_X11_XRobotPeer_getNumberOfButtonsImpl(JNIEnv *env,
jclass cls) {
// At the moment this routine being called we already should have an initialized num_buttons variable.
return num_buttons;
}
JNIEXPORT void JNICALL
Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
@ -386,6 +338,8 @@ void mouseAction(JNIEnv *env,
{
AWT_LOCK();
int32_t num_buttons = getNumButtons(); //from XToolkit.c
DTRACE_PRINTLN1("RobotPeer: mouseAction(%i)", buttonMask);
DTRACE_PRINTLN1("RobotPeer: mouseAction, press = %d", isMousePress);

@ -119,6 +119,50 @@ typedef struct _DamageRect {
} DamageRect;
#ifndef HEADLESS
/* Note: until we include the <X11/extensions/Xrender.h> explicitly
* we have to define a couple of things ourselves.
*/
typedef unsigned long PictFormat;
#define PictTypeIndexed 0
#define PictTypeDirect 1
typedef struct {
short red;
short redMask;
short green;
short greenMask;
short blue;
short blueMask;
short alpha;
short alphaMask;
} XRenderDirectFormat;
typedef struct {
PictFormat id;
int type;
int depth;
XRenderDirectFormat direct;
Colormap colormap;
} XRenderPictFormat;
#define PictFormatID (1 << 0)
#define PictFormatType (1 << 1)
#define PictFormatDepth (1 << 2)
#define PictFormatRed (1 << 3)
#define PictFormatRedMask (1 << 4)
#define PictFormatGreen (1 << 5)
#define PictFormatGreenMask (1 << 6)
#define PictFormatBlue (1 << 7)
#define PictFormatBlueMask (1 << 8)
#define PictFormatAlpha (1 << 9)
#define PictFormatAlphaMask (1 << 10)
#define PictFormatColormap (1 << 11)
typedef XRenderPictFormat *
XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
/* END OF Xrender.h chunk */
typedef struct _AwtGraphicsConfigData {
int awt_depth;
Colormap awt_cmap;
@ -136,6 +180,7 @@ typedef struct _AwtGraphicsConfigData {
ColorData *color_data;
struct _GLXGraphicsConfigInfo *glxInfo;
int isTranslucencySupported; /* Uses Xrender to find this out. */
XRenderPictFormat renderPictFormat; /*Used only if translucency supported*/
} AwtGraphicsConfigData;
typedef AwtGraphicsConfigData* AwtGraphicsConfigDataPtr;

@ -45,10 +45,14 @@
#include "sun_awt_X11_XToolkit.h"
#include "java_awt_SystemColor.h"
#include "java_awt_TrayIcon.h"
#include <X11/extensions/XTest.h>
uint32_t awt_NumLockMask = 0;
Boolean awt_ModLockIsShiftLock = False;
static int32_t num_buttons = 0;
int32_t getNumButtons();
extern JavaVM *jvm;
// Tracing level
@ -575,7 +579,6 @@ performPoll(JNIEnv *env, jlong nextTaskTime) {
pollFds[1].revents = 0;
}
AWT_NOFLUSH_UNLOCK();
/* ACTUALLY DO THE POLL() */
@ -684,8 +687,6 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11_XToolkit_getEnv
return ret;
}
static XErrorHandler saved_error_handler = NULL;
#ifdef __linux__
void print_stack(void)
{
@ -706,38 +707,6 @@ void print_stack(void)
}
#endif
static int NoisyXErrorHandler(Display * dpy, XErrorEvent * event) {
fprintf(stderr, "id=%x, serial=%x, ec=%d, rc=%d, mc=%d\n",
event->resourceid, event->serial, event->error_code,
event->request_code, event->minor_code);
/*
#ifdef __linux__
print_stack();
#endif
*/
if (jvm != NULL) {
JNIEnv * env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
JNU_CallStaticMethodByName(env, NULL, "java/lang/Thread", "dumpStack", "()V");
}
if (!saved_error_handler) {
return saved_error_handler(dpy, event);
}
return 0;
}
/*
* Class: sun_awt_X11_XToolkit
* Method: setNoisyXErrorHandler
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_sun_awt_X11_XToolkit_setNoisyXErrorHandler
(JNIEnv *env , jclass clazz)
{
(*env)->GetJavaVM(env, &jvm);
saved_error_handler = XSetErrorHandler(NoisyXErrorHandler);
}
Window get_xawt_root_shell(JNIEnv *env) {
static jclass classXRootWindow = NULL;
static jmethodID methodGetXRootWindow = NULL;
@ -943,3 +912,80 @@ Java_java_awt_Cursor_finalizeImpl(JNIEnv *env, jclass clazz, jlong pData)
AWT_UNLOCK();
}
}
/*
* Class: sun_awt_X11_XToolkit
* Method: getNumberOfButtonsImpl
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl
(JNIEnv * env, jobject cls){
if (num_buttons == 0) {
num_buttons = getNumButtons();
}
return num_buttons;
}
int32_t getNumButtons() {
int32_t major_opcode, first_event, first_error;
int32_t xinputAvailable;
int32_t numDevices, devIdx, clsIdx;
XDeviceInfo* devices;
XDeviceInfo* aDevice;
XButtonInfo* bInfo;
int32_t local_num_buttons = 0;
/* 4700242:
* If XTest is asked to press a non-existant mouse button
* (i.e. press Button3 on a system configured with a 2-button mouse),
* then a crash may happen. To avoid this, we use the XInput
* extension to query for the number of buttons on the XPointer, and check
* before calling XTestFakeButtonEvent().
*/
xinputAvailable = XQueryExtension(awt_display, INAME, &major_opcode, &first_event, &first_error);
DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XINPUT) returns major_opcode = %d, first_event = %d, first_error = %d",
major_opcode, first_event, first_error);
if (xinputAvailable) {
devices = XListInputDevices(awt_display, &numDevices);
for (devIdx = 0; devIdx < numDevices; devIdx++) {
aDevice = &(devices[devIdx]);
#ifdef IsXExtensionPointer
if (aDevice->use == IsXExtensionPointer) {
for (clsIdx = 0; clsIdx < aDevice->num_classes; clsIdx++) {
if (aDevice->inputclassinfo[clsIdx].class == ButtonClass) {
bInfo = (XButtonInfo*)(&(aDevice->inputclassinfo[clsIdx]));
local_num_buttons = bInfo->num_buttons;
DTRACE_PRINTLN1("RobotPeer: XPointer has %d buttons", num_buttons);
break;
}
}
break;
}
#endif
if (local_num_buttons <= 0 ) {
if (aDevice->use == IsXPointer) {
for (clsIdx = 0; clsIdx < aDevice->num_classes; clsIdx++) {
if (aDevice->inputclassinfo[clsIdx].class == ButtonClass) {
bInfo = (XButtonInfo*)(&(aDevice->inputclassinfo[clsIdx]));
local_num_buttons = bInfo->num_buttons;
DTRACE_PRINTLN1("RobotPeer: XPointer has %d buttons", num_buttons);
break;
}
}
break;
}
}
}
XFreeDeviceList(devices);
}
else {
DTRACE_PRINTLN1("RobotPeer: XINPUT extension is unavailable, assuming %d mouse buttons", num_buttons);
}
if (local_num_buttons == 0 ) {
local_num_buttons = 3;
}
return local_num_buttons;
}

@ -1186,7 +1186,7 @@ JavaVM* jvm = NULL;
static int ToolkitErrorHandler(Display * dpy, XErrorEvent * event) {
if (jvm != NULL) {
JNIEnv * env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit", "GlobalErrorHandler", "(JJ)I",
return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit", "globalErrorHandler", "(JJ)I",
ptr_to_jlong(dpy), ptr_to_jlong(event)).i;
} else {
return 0;
@ -1229,6 +1229,28 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_CallErrorHandler
return (*(XErrorHandler)jlong_to_ptr(handler))((Display*) jlong_to_ptr(display), (XErrorEvent*) jlong_to_ptr(event_ptr));
}
/*
* Class: sun_awt_X11_XlibWrapper
* Method: PrintXErrorEvent
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent
(JNIEnv *env, jclass clazz, jlong display, jlong event_ptr)
{
char msg[128];
char buf[128];
XErrorEvent* err = (XErrorEvent *)jlong_to_ptr(event_ptr);
XGetErrorText((Display *)jlong_to_ptr(display), err->error_code, msg, sizeof(msg));
jio_fprintf(stderr, "Xerror %s, XID %x, ser# %d\n", msg, err->resourceid, err->serial);
jio_snprintf(buf, sizeof(buf), "%d", err->request_code);
XGetErrorDatabaseText((Display *)jlong_to_ptr(display), "XRequest", buf, "Unknown", msg, sizeof(msg));
jio_fprintf(stderr, "Major opcode %d (%s)\n", err->request_code, msg);
if (err->request_code > 128) {
jio_fprintf(stderr, "Minor opcode %d\n", err->minor_code);
}
}
/*

@ -527,7 +527,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return Whether this is a file system shell folder
*/
public synchronized boolean isFileSystem() {
public boolean isFileSystem() {
if (cachedIsFileSystem == null) {
cachedIsFileSystem = hasAttribute(ATTRIB_FILESYSTEM);
}
@ -543,8 +543,8 @@ final class Win32ShellFolder2 extends ShellFolder {
public Boolean call() throws Exception {
// Caching at this point doesn't seem to be cost efficient
return (getAttributes0(getParentIShellFolder(),
getRelativePIDL(), attribute)
& attribute) != 0;
getRelativePIDL(), attribute)
& attribute) != 0;
}
});
}
@ -761,7 +761,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return Whether this shell folder is a link
*/
public synchronized boolean isLink() {
public boolean isLink() {
if (cachedIsLink == null) {
cachedIsLink = hasAttribute(ATTRIB_LINK);
}
@ -1160,8 +1160,16 @@ final class Win32ShellFolder2 extends ShellFolder {
private static native int compareIDsByColumn(long pParentIShellFolder, long pidl1, long pidl2, int columnIdx);
public void sortChildren(List<? extends File> files) {
Collections.sort(files, new ColumnComparator(getIShellFolder(), 0));
public void sortChildren(final List<? extends File> files) {
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
getInvoker().invoke(new Callable<Void>() {
public Void call() throws Exception {
Collections.sort(files, new ColumnComparator(getIShellFolder(), 0));
return null;
}
});
}
private static class ColumnComparator implements Comparator<File> {

@ -478,21 +478,22 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
public <T> T invoke(Callable<T> task) {
try {
T result;
if (Thread.currentThread() == comThread) {
// if it's already called from the COM
// thread, we don't need to delegate the task
result = task.call();
return task.call();
} else {
Future<T> future = submit(task);
try {
result = future.get();
} catch (InterruptedException e) {
result = null;
future.cancel(true);
while (true) {
Future<T> future = submit(task);
try {
return future.get();
} catch (InterruptedException e) {
// Repeat the attempt
future.cancel(true);
}
}
}
return result;
} catch (Exception e) {
Throwable cause = (e instanceof ExecutionException) ? e.getCause() : e;
if (cause instanceof RuntimeException) {

@ -105,9 +105,10 @@ public abstract class TranslucentWindowPainter {
}
/**
* Creates (if needed), clears and returns the buffer for this painter.
* Creates (if needed), clears (if requested) and returns the buffer
* for this painter.
*/
protected abstract Image getBackBuffer();
protected abstract Image getBackBuffer(boolean clear);
/**
* Updates the the window associated with this painter with the contents
@ -123,31 +124,16 @@ public abstract class TranslucentWindowPainter {
public abstract void flush();
/**
* Updates the window associated with the painter given the passed image.
* If the passed image is null the painter will use its own buffer for
* rendering the contents of the window into it and updating the window.
* Updates the window associated with the painter.
*
* If the passed buffer has dimensions different from the window, it is
* copied into the internal buffer first and the latter is used to update
* the window.
*
* @param bb the image to update the non opaque window with, or null.
* If not null, the image must be of ARGB_PRE type.
* @param repaint indicates if the window should be completely repainted
* to the back buffer using {@link java.awt.Window#paintAll} before update.
*/
public void updateWindow(Image bb) {
public void updateWindow(boolean repaint) {
boolean done = false;
if (bb != null && (window.getWidth() != bb.getWidth(null) ||
window.getHeight() != bb.getHeight(null)))
{
Image ourBB = getBackBuffer();
Graphics2D g = (Graphics2D)ourBB.getGraphics();
g.drawImage(bb, 0, 0, null);
g.dispose();
bb = ourBB;
}
do {
if (bb == null) {
bb = getBackBuffer();
Image bb = getBackBuffer(repaint);
while (!done) {
if (repaint) {
Graphics2D g = (Graphics2D)bb.getGraphics();
try {
window.paintAll(g);
@ -156,17 +142,12 @@ public abstract class TranslucentWindowPainter {
}
}
peer.paintAppletWarning((Graphics2D)bb.getGraphics(),
bb.getWidth(null), bb.getHeight(null));
done = update(bb);
// in case they passed us a lost VI, next time around we'll use our
// own bb because we can not validate and restore the contents of
// their VI
if (!done) {
bb = null;
repaint = true;
bb = getBackBuffer(true);
}
} while (!done);
}
}
private static final Image clearImage(Image bb) {
@ -190,30 +171,24 @@ public abstract class TranslucentWindowPainter {
* method (VI, BI, regular Images).
*/
private static class BIWindowPainter extends TranslucentWindowPainter {
private WeakReference<BufferedImage> biRef;
private BufferedImage backBuffer;
protected BIWindowPainter(WWindowPeer peer) {
super(peer);
}
private BufferedImage getBIBackBuffer() {
@Override
protected Image getBackBuffer(boolean clear) {
int w = window.getWidth();
int h = window.getHeight();
BufferedImage bb = biRef == null ? null : biRef.get();
if (bb == null || bb.getWidth() != w || bb.getHeight() != h) {
if (bb != null) {
bb.flush();
bb = null;
}
bb = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
biRef = new WeakReference<BufferedImage>(bb);
if (backBuffer == null ||
backBuffer.getWidth() != w ||
backBuffer.getHeight() != h)
{
flush();
backBuffer = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
}
return (BufferedImage)clearImage(bb);
}
@Override
protected Image getBackBuffer() {
return getBIBackBuffer();
return clear ? (BufferedImage)clearImage(backBuffer) : backBuffer;
}
@Override
@ -246,10 +221,7 @@ public abstract class TranslucentWindowPainter {
}
// copy the passed image into our own buffer, then upload
BufferedImage bi = getBIBackBuffer();
Graphics2D g = (Graphics2D)bi.getGraphics();
g.setComposite(AlphaComposite.Src);
g.drawImage(bb, 0, 0, null);
BufferedImage bi = (BufferedImage)clearImage(backBuffer);
int data[] =
((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
@ -259,8 +231,9 @@ public abstract class TranslucentWindowPainter {
}
public void flush() {
if (biRef != null) {
biRef.clear();
if (backBuffer != null) {
backBuffer.flush();
backBuffer = null;
}
}
}
@ -271,27 +244,22 @@ public abstract class TranslucentWindowPainter {
* Java heap-based buffer (which is then uploaded to the layered window)
*/
private static class VIWindowPainter extends BIWindowPainter {
private WeakReference<VolatileImage> viRef;
private VolatileImage viBB;
protected VIWindowPainter(WWindowPeer peer) {
super(peer);
}
@Override
protected Image getBackBuffer() {
protected Image getBackBuffer(boolean clear) {
int w = window.getWidth();
int h = window.getHeight();
GraphicsConfiguration gc = peer.getGraphicsConfiguration();
VolatileImage viBB = viRef == null ? null : viRef.get();
if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
viBB.validate(gc) == IMAGE_INCOMPATIBLE)
{
if (viBB != null) {
viBB.flush();
viBB = null;
}
flush();
if (gc instanceof AccelGraphicsConfig) {
AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
@ -303,21 +271,16 @@ public abstract class TranslucentWindowPainter {
viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
}
viBB.validate(gc);
viRef = new WeakReference<VolatileImage>(viBB);
}
return clearImage(viBB);
return clear ? clearImage(viBB) : viBB;
}
@Override
public void flush() {
if (viRef != null) {
VolatileImage viBB = viRef.get();
if (viBB != null) {
viBB.flush();
viBB = null;
}
viRef.clear();
if (viBB != null) {
viBB.flush();
viBB = null;
}
}
}

@ -78,25 +78,6 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
super.paint(g);
}
public void print(Graphics g) {
if (!(target instanceof Window) ||
AWTAccessor.getWindowAccessor().isOpaque((Window)target))
{
Dimension d = ((Component)target).getSize();
if (g instanceof Graphics2D ||
g instanceof sun.awt.Graphics2Delegate) {
// background color is setup correctly, so just use clearRect
g.clearRect(0, 0, d.width, d.height);
} else {
// emulate clearRect
g.setColor(((Component)target).getBackground());
g.fillRect(0, 0, d.width, d.height);
g.setColor(((Component)target).getForeground());
}
}
super.print(g);
}
public boolean shouldClearRectBeforePaint() {
return eraseBackground;
}

@ -239,7 +239,8 @@ public abstract class WComponentPeer extends WObjectPeer
private static final double BANDING_DIVISOR = 4.0;
private native int[] createPrintedPixels(int srcX, int srcY,
int srcW, int srcH);
int srcW, int srcH,
int alpha);
public void print(Graphics g) {
Component comp = (Component)target;
@ -261,7 +262,9 @@ public abstract class WComponentPeer extends WObjectPeer
}
int h = endY - startY + 1;
int[] pix = createPrintedPixels(0, startY, totalW, h);
Color bgColor = comp.getBackground();
int[] pix = createPrintedPixels(0, startY, totalW, h,
bgColor == null ? 255 : bgColor.getAlpha());
if (pix != null) {
BufferedImage bim = new BufferedImage(totalW, h,
BufferedImage.TYPE_INT_ARGB);
@ -488,13 +491,14 @@ public abstract class WComponentPeer extends WObjectPeer
}
}
public void updateGraphicsData(GraphicsConfiguration gc) {
public boolean updateGraphicsData(GraphicsConfiguration gc) {
winGraphicsConfig = (Win32GraphicsConfig)gc;
try {
replaceSurfaceData();
} catch (InvalidPipeException e) {
// REMIND : what do we do if our surface creation failed?
}
return false;
}
//This will return null for Components not yet added to a Container

@ -42,6 +42,9 @@ abstract class WObjectPeer {
// set from JNI if any errors in creating the peer occur
protected Error createError = null;
// used to synchronize the state of this peer
private final Object stateLock = new Object();
public static WObjectPeer getPeerForTarget(Object t) {
WObjectPeer peer = (WObjectPeer) WToolkit.targetToPeer(t);
return peer;
@ -55,6 +58,10 @@ abstract class WObjectPeer {
return target;
}
public final Object getStateLock() {
return stateLock;
}
/*
* Subclasses should override disposeImpl() instead of dispose(). Client
* code should always invoke dispose(), never disposeImpl().

@ -60,8 +60,6 @@ class WRobotPeer extends WObjectPeer implements RobotPeer
}
public native int getRGBPixelImpl(int x, int y);
public native int getNumberOfButtons();
public int [] getRGBPixels(Rectangle bounds) {
int pixelArray[] = new int[bounds.width*bounds.height];
getRGBPixels(bounds.x, bounds.y, bounds.width, bounds.height, pixelArray);

@ -982,6 +982,16 @@ public class WToolkit extends SunToolkit implements Runnable {
return areExtraMouseButtonsEnabled;
}
private native synchronized int getNumberOfButtonsImpl();
@Override
public int getNumberOfButtons(){
if (numberOfButtons == 0) {
numberOfButtons = getNumberOfButtonsImpl();
}
return (numberOfButtons > MAX_BUTTONS_SUPPORTED)? MAX_BUTTONS_SUPPORTED : numberOfButtons;
}
@Override
public boolean isWindowOpacitySupported() {
// supported in Win2K and later

@ -54,7 +54,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
private boolean isOpaque;
private volatile TranslucentWindowPainter painter;
private TranslucentWindowPainter painter;
/*
* A key used for storing a list of active windows in AppContext. The value
@ -106,11 +106,13 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
GraphicsConfiguration gc = getGraphicsConfiguration();
((Win32GraphicsDevice)gc.getDevice()).removeDisplayChangedListener(this);
TranslucentWindowPainter currentPainter = painter;
if (currentPainter != null) {
currentPainter.flush();
// don't set the current one to null here; reduces the chances of
// MT issues (like NPEs)
synchronized (getStateLock()) {
TranslucentWindowPainter currentPainter = painter;
if (currentPainter != null) {
currentPainter.flush();
// don't set the current one to null here; reduces the chances of
// MT issues (like NPEs)
}
}
super.disposeImpl();
@ -178,9 +180,23 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
updateIconImages();
updateShape();
updateOpacity();
updateOpaque();
Shape shape = ((Window)target).getShape();
if (shape != null) {
applyShape(Region.getInstance(shape, null));
}
float opacity = ((Window)target).getOpacity();
if (opacity < 1.0f) {
setOpacity(opacity);
}
synchronized (getStateLock()) {
// default value of a boolean field is 'false', so set isOpaque to
// true here explicitly
this.isOpaque = true;
Color bgColor = ((Window)target).getBackground();
setOpaque((bgColor == null) || (bgColor.getAlpha() == 255));
}
}
native void createAwtWindow(WComponentPeer parent);
@ -214,7 +230,11 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
setAlwaysOnTop(alwaysOnTop);
}
updateWindow(null);
synchronized (getStateLock()) {
if (!isOpaque) {
updateWindow(true);
}
}
}
// Synchronize the insets members (here & in helper) with actual window
@ -334,29 +354,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
}
private void updateShape() {
Shape shape = ((Window)target).getShape();
if (shape != null) {
applyShape(Region.getInstance(shape, null));
}
}
private void updateOpacity() {
float opacity = ((Window)target).getOpacity();
if (opacity < 1.0f) {
setOpacity(opacity);
}
}
private void updateOpaque() {
this.isOpaque = true;
// boolean opaque = ((Window)target).isOpaque();
boolean opaque = AWTAccessor.getWindowAccessor().isOpaque((Window)target);
if (!opaque) {
setOpaque(opaque);
}
}
native void setMinSize(int width, int height);
/*
@ -579,6 +576,26 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
}
@Override
public Graphics getGraphics() {
synchronized (getStateLock()) {
if (!isOpaque) {
return painter.getBackBuffer(false).getGraphics();
}
}
return super.getGraphics();
}
@Override
public void setBackground(Color c) {
super.setBackground(c);
synchronized (getStateLock()) {
if (!isOpaque && ((Window)target).isVisible()) {
updateWindow(true);
}
}
}
private native void setOpacity(int iOpacity);
public void setOpacity(float opacity) {
@ -600,12 +617,23 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
setOpacity(iOpacity);
updateWindow(null);
synchronized (getStateLock()) {
if (!isOpaque && ((Window)target).isVisible()) {
updateWindow(true);
}
}
}
private native void setOpaqueImpl(boolean isOpaque);
public void setOpaque(boolean isOpaque) {
synchronized (getStateLock()) {
if (this.isOpaque == isOpaque) {
return;
}
}
Window target = (Window)getTarget();
if (!isOpaque) {
@ -617,20 +645,17 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
}
boolean opaqueChanged = this.isOpaque != isOpaque;
boolean isVistaOS = Win32GraphicsEnvironment.isVistaOS();
if (opaqueChanged && !isVistaOS){
if (!isVistaOS) {
// non-Vista OS: only replace the surface data if the opacity
// status changed (see WComponentPeer.isAccelCapable() for more)
replaceSurfaceDataRecursively(target);
}
this.isOpaque = isOpaque;
setOpaqueImpl(isOpaque);
if (opaqueChanged) {
synchronized (getStateLock()) {
this.isOpaque = isOpaque;
setOpaqueImpl(isOpaque);
if (isOpaque) {
TranslucentWindowPainter currentPainter = painter;
if (currentPainter != null) {
@ -642,7 +667,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
}
if (opaqueChanged && isVistaOS) {
if (isVistaOS) {
// On Vista: setting the window non-opaque makes the window look
// rectangular, though still catching the mouse clicks within
// its shape only. To restore the correct visual appearance
@ -654,42 +679,33 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
}
updateWindow(null);
if (((Window)target).isVisible()) {
updateWindow(true);
}
}
public native void updateWindowImpl(int[] data, int width, int height);
public void updateWindow(BufferedImage backBuffer) {
if (isOpaque) {
return;
}
Component target = (Component)this.target;
if (target.getWidth() <= 0 || target.getHeight() <= 0) {
return;
}
TranslucentWindowPainter currentPainter = painter;
if (currentPainter != null) {
currentPainter.updateWindow(backBuffer);
} else if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER,
"Translucent window painter is null in updateWindow");
}
public void updateWindow() {
updateWindow(false);
}
/**
* Paints the Applet Warning into the passed Graphics2D. This method is
* called by the TranslucentWindowPainter before updating the layered
* window.
*
* @param g Graphics context to paint the warning to
* @param w the width of the area
* @param h the height of the area
* @see TranslucentWindowPainter
*/
public void paintAppletWarning(Graphics2D g, int w, int h) {
// REMIND: the applet warning needs to be painted here
private void updateWindow(boolean repaint) {
Window w = (Window)target;
synchronized (getStateLock()) {
if (isOpaque || !w.isVisible() ||
(w.getWidth() <= 0) || (w.getHeight() <= 0))
{
return;
}
TranslucentWindowPainter currentPainter = painter;
if (currentPainter != null) {
currentPainter.updateWindow(repaint);
} else if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER,
"Translucent window painter is null in updateWindow");
}
}
}
/*

@ -30,6 +30,7 @@
#include "jlong.h"
#include "awt_AWTEvent.h"
#include "awt_BitmapUtil.h"
#include "awt_Component.h"
#include "awt_Cursor.h"
#include "awt_Dimension.h"
@ -127,6 +128,7 @@ struct CreatePrintedPixelsStruct {
jobject component;
int srcx, srcy;
int srcw, srch;
jint alpha;
};
// Struct for _SetRectangularShape() method
struct SetRectangularShapeStruct {
@ -361,8 +363,8 @@ AwtComponent* AwtComponent::GetComponent(HWND hWnd) {
AwtComponent* AwtComponent::GetComponentImpl(HWND hWnd) {
AwtComponent *component =
(AwtComponent *)::GetWindowLongPtr(hWnd, GWLP_USERDATA);
DASSERT( !IsBadReadPtr(component, sizeof(AwtComponent)) );
DASSERT( component->GetHWnd() == hWnd );
DASSERT(!component || !IsBadReadPtr(component, sizeof(AwtComponent)) );
DASSERT(!component || component->GetHWnd() == hWnd );
return component;
}
@ -1918,11 +1920,14 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
mr = mrConsume;
break;
}
case WM_AWT_CREATE_PRINTED_PIXELS:
retValue = (LRESULT)CreatePrintedPixels(*((SIZE *)wParam),
*((SIZE *)lParam));
case WM_AWT_CREATE_PRINTED_PIXELS: {
CreatePrintedPixelsStruct* cpps = (CreatePrintedPixelsStruct*)wParam;
SIZE loc = { cpps->srcx, cpps->srcy };
SIZE size = { cpps->srcw, cpps->srch };
retValue = (LRESULT)CreatePrintedPixels(loc, size, cpps->alpha);
mr = mrConsume;
break;
}
case WM_UNDOCUMENTED_CLICKMENUBAR:
{
if (::IsWindow(AwtWindow::GetModalBlocker(GetHWnd()))) {
@ -4526,18 +4531,20 @@ void AwtComponent::FillBackground(HDC hMemoryDC, SIZE &size)
void AwtComponent::FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha)
{
if (bitmapBits) {
DWORD* dest = (DWORD*)bitmapBits;
//XXX: might be optimized to use one loop (cy*cx -> 0).
for (int i = 0; i < size.cy; i++ ) {
for (int j = 0; j < size.cx; j++ ) {
((BYTE*)(dest++))[3] = alpha;
}
if (!bitmapBits) {
return;
}
DWORD* dest = (DWORD*)bitmapBits;
//XXX: might be optimized to use one loop (cy*cx -> 0)
for (int i = 0; i < size.cy; i++ ) {
for (int j = 0; j < size.cx; j++ ) {
((BYTE*)(dest++))[3] = alpha;
}
}
}
jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size) {
jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size, int alpha) {
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
if (!::IsWindowVisible(GetHWnd())) {
@ -4549,12 +4556,12 @@ jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size) {
return NULL;
}
HDC hMemoryDC = ::CreateCompatibleDC(hdc);
HBITMAP hBitmap = ::CreateCompatibleBitmap(hdc, size.cx, size.cy);
void *bitmapBits = NULL;
HBITMAP hBitmap = BitmapUtil::CreateARGBBitmap(size.cx, size.cy, &bitmapBits);
HBITMAP hOldBitmap = (HBITMAP)::SelectObject(hMemoryDC, hBitmap);
SendMessage(WM_AWT_RELEASEDC, (WPARAM)hdc);
RECT eraseR = { 0, 0, size.cx, size.cy };
VERIFY(::FillRect(hMemoryDC, &eraseR, GetBackgroundBrush()));
FillBackground(hMemoryDC, size);
VERIFY(::SetWindowOrgEx(hMemoryDC, loc.cx, loc.cy, NULL));
@ -4562,6 +4569,14 @@ jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size) {
// above.
SendMessage(WM_PRINT, (WPARAM)hMemoryDC, PRF_CLIENT | PRF_NONCLIENT);
// First make sure the system completed any drawing to the bitmap.
::GdiFlush();
// WM_PRINT does not fill the alpha-channel of the ARGB bitmap
// leaving it equal to zero. Hence we need to fill it manually. Otherwise
// the pixels will be considered transparent when interpreting the data.
FillAlpha(bitmapBits, size, alpha);
::SelectObject(hMemoryDC, hOldBitmap);
BITMAPINFO bmi;
@ -5937,10 +5952,6 @@ jintArray AwtComponent::_CreatePrintedPixels(void *param)
CreatePrintedPixelsStruct *cpps = (CreatePrintedPixelsStruct *)param;
jobject self = cpps->component;
jint srcx = cpps->srcx;
jint srcy = cpps->srcy;
jint srcw = cpps->srcw;
jint srch = cpps->srch;
jintArray result = NULL;
AwtComponent *c = NULL;
@ -5950,12 +5961,7 @@ jintArray AwtComponent::_CreatePrintedPixels(void *param)
c = (AwtComponent *)pData;
if (::IsWindow(c->GetHWnd()))
{
SIZE loc = { srcx, srcy };
SIZE size = { srcw, srch };
result = (jintArray)
c->SendMessage(WM_AWT_CREATE_PRINTED_PIXELS, (WPARAM)&loc,
(LPARAM)&size);
result = (jintArray)c->SendMessage(WM_AWT_CREATE_PRINTED_PIXELS, (WPARAM)cpps, 0);
}
ret:
env->DeleteGlobalRef(self);
@ -6749,7 +6755,7 @@ Java_sun_awt_windows_WComponentPeer_getTargetGC(JNIEnv* env, jobject theThis)
*/
JNIEXPORT jintArray JNICALL
Java_sun_awt_windows_WComponentPeer_createPrintedPixels(JNIEnv* env,
jobject self, jint srcX, jint srcY, jint srcW, jint srcH)
jobject self, jint srcX, jint srcY, jint srcW, jint srcH, jint alpha)
{
TRY;
@ -6761,6 +6767,7 @@ Java_sun_awt_windows_WComponentPeer_createPrintedPixels(JNIEnv* env,
cpps->srcy = srcY;
cpps->srcw = srcW;
cpps->srch = srcH;
cpps->alpha = alpha;
jintArray globalRef = (jintArray)AwtToolkit::GetInstance().SyncCall(
(void*(*)(void*))AwtComponent::_CreatePrintedPixels, cpps);

@ -596,7 +596,7 @@ public:
void UpdateColorModel();
jintArray CreatePrintedPixels(SIZE &loc, SIZE &size);
jintArray CreatePrintedPixels(SIZE &loc, SIZE &size, int alpha);
/*
* HWND, AwtComponent and Java Peer interaction
@ -738,7 +738,6 @@ protected:
virtual void SetDragCapture(UINT flags);
virtual void ReleaseDragCapture(UINT flags);
//These functions are overridden in AwtWindow to handle non-opaque windows.
virtual void FillBackground(HDC hMemoryDC, SIZE &size);
virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);

Some files were not shown because too many files have changed in this diff Show More