22593000 Upgrade xscreensaver to version 5.34
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Tue, 08 Mar 2016 09:00:31 -0800
changeset 5561 0416d82f7f55
parent 5560 61114c4b4667
child 5562 880dc66054d5
22593000 Upgrade xscreensaver to version 5.34 22557069 problem in GNOME/SCREENSAVER
components/desktop/xscreensaver/Makefile
components/desktop/xscreensaver/patches/0001-Solaris-app-defaults.patch
components/desktop/xscreensaver/patches/0002-GNOME-desktop-menu.patch
components/desktop/xscreensaver/patches/0003-Solaris-paths.patch
components/desktop/xscreensaver/patches/0004-atoms.patch
components/desktop/xscreensaver/patches/0005-gtk-lock.patch
components/desktop/xscreensaver/patches/0006-allow-root.patch
components/desktop/xscreensaver/patches/0007-passwdTimeout-pref.patch
components/desktop/xscreensaver/patches/0008-security-policy.patch
components/desktop/xscreensaver/patches/0009-pam-audit.patch
components/desktop/xscreensaver/patches/0010-barcode-hack.patch
components/desktop/xscreensaver/patches/0011-glsnake-hack.patch
components/desktop/xscreensaver/patches/0012-bug-15426641.patch
components/desktop/xscreensaver/patches/0013-bug-15411287.patch
components/desktop/xscreensaver/patches/0014-bug-15412661.patch
components/desktop/xscreensaver/patches/0015-bug-15411306.patch
components/desktop/xscreensaver/patches/0016-bug-15141135.patch
components/desktop/xscreensaver/patches/0017-bug-15574928.patch
components/desktop/xscreensaver/patches/0018-verbose-messages.patch
components/desktop/xscreensaver/patches/0019-bug-15706879.patch
components/desktop/xscreensaver/patches/0020-bug-15769303.patch
components/desktop/xscreensaver/patches/0021-forkpty.patch
components/desktop/xscreensaver/patches/0022-photopile-title.patch
components/desktop/xscreensaver/patches/01-intltool.patch
components/desktop/xscreensaver/patches/02-Solaris.app-defaults.patch
components/desktop/xscreensaver/patches/03-GNOME-desktop.patch
components/desktop/xscreensaver/patches/04-solaris-paths.patch
components/desktop/xscreensaver/patches/05-atoms.patch
components/desktop/xscreensaver/patches/06-gtk-lock.patch
components/desktop/xscreensaver/patches/07-allow-root.patch
components/desktop/xscreensaver/patches/08-passwdTimeout-pref.patch
components/desktop/xscreensaver/patches/09-dpms.patch
components/desktop/xscreensaver/patches/10-security_policy.patch
components/desktop/xscreensaver/patches/11-pam_audit.patch
components/desktop/xscreensaver/patches/12-barcode-hack.patch
components/desktop/xscreensaver/patches/13-glsnake.patch
components/desktop/xscreensaver/patches/14-bug-15426641.patch
components/desktop/xscreensaver/patches/15-bug-15411287.patch
components/desktop/xscreensaver/patches/16-bug-15412661.patch
components/desktop/xscreensaver/patches/17-bug-15411306.patch
components/desktop/xscreensaver/patches/18-bug-15141135.patch
components/desktop/xscreensaver/patches/19-bug-15574928.patch
components/desktop/xscreensaver/patches/20-bug-15652522.patch
components/desktop/xscreensaver/patches/21-verbose.patch
components/desktop/xscreensaver/patches/22-bug-15706879.patch
components/desktop/xscreensaver/patches/23-bug-15769303.patch
components/desktop/xscreensaver/patches/24-bug-15772119.patch
components/desktop/xscreensaver/patches/25-bug-15700093.patch
components/desktop/xscreensaver/patches/26-forkpty.patch
components/desktop/xscreensaver/patches/27-bug-22706313.patch
components/desktop/xscreensaver/patches/28-photopile-title.patch
components/desktop/xscreensaver/xscreensaver-hacks-gl.p5m
components/desktop/xscreensaver/xscreensaver-hacks.p5m
--- a/components/desktop/xscreensaver/Makefile	Mon Mar 07 13:01:10 2016 -0800
+++ b/components/desktop/xscreensaver/Makefile	Tue Mar 08 09:00:31 2016 -0800
@@ -26,19 +26,16 @@
 include ../../../make-rules/shared-macros.mk
 
 COMPONENT_NAME=		xscreensaver
-COMPONENT_VERSION=	5.15
+COMPONENT_VERSION=	5.34
 COMPONENT_PROJECT_URL=	https://www.jwz.org/xscreensaver/
 COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
 COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:4f6d1f1e4c15dbb74e2296f8fe57a73d47d602515178c248bbc838f779d5082d
-#COMPONENT_ARCHIVE_URL=	https://www.jwz.org/xscreensaver/$(COMPONENT_ARCHIVE)
-# jwz removes older tarballs, and 5.15 is no longer on his site, so borrow
-# Fedora's archive until we update
-COMPONENT_ARCHIVE_URL=	http://pkgs.fedoraproject.org/repo/pkgs/xscreensaver/xscreensaver-5.15.tar.gz/c0b8b2c817a9a7371f51a82e80602d10/$(COMPONENT_ARCHIVE)
+    sha256:6fff7ec4be743e5c042647ea9687dd0cdf48d1dd5e8e15098e5018bbd02e5e27
+COMPONENT_ARCHIVE_URL=	https://www.jwz.org/xscreensaver/$(COMPONENT_ARCHIVE)
 COMPONENT_BUGDB=        gnome/screensaver
 
-TPNO=			9370
+TPNO=			26341
 
 include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/configure-64.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0001-Solaris-app-defaults.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,230 @@
+From ed0b348f926a4bb5df19f59a6a86ab0030891b04 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 19:40:40 -0800
+Subject: [PATCH] Solaris app-defaults
+
+Various settings to meet Solaris policies/preferences, including:
+
+   -     enable screen lock by default, disable splash screen by default
+   -     disable using screen grabs in hacks to avoid security leaks
+   -     set default mode to screen blank
+   -     disable bsod by default to avoid confusion in shops with real NT boxes
+   -     enable & disable various hacks by default for branding reasons
+   -     branding changes for various hacks & defaults (like RSS feed)
+15162280 SUNBT4871833 DPMS settings should be consistent between CDE and Gnome
+15305084 SUNBT6368607 increase unlock dialog box timeout to 2 minutes
+15379785 SUNBT6526791 xscreensaver and Xorg need to change timeouts for MOU4
+15451768 SUNBT6652454 xscreensaver does not invoke after IDLE time expires
+
+Not suitable for upstream as these represent our differences of opinion or
+differences of requirements with upstreams.
+---
+ driver/XScreenSaver.ad.in | 66 +++++++++++++++++++++++------------------------
+ 1 file changed, 32 insertions(+), 34 deletions(-)
+
+diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in
+index 1c1850f..22d5bcb 100644
+--- a/driver/XScreenSaver.ad.in
++++ b/driver/XScreenSaver.ad.in
[email protected]@ -28,42 +28,43 @@
+ 
+ ! /* (xrdb prevention kludge: whole file)
+ 
+-*mode:			random
++*mode:			blank
+ *timeout:		0:10:00
+ *cycle:			0:10:00
+ *lockTimeout:		0:00:00
+-*passwdTimeout:		0:00:30
+-*dpmsEnabled:		False
++*passwdTimeout:		0:02:00
++*dpmsEnabled:		True
+ *dpmsQuickoffEnabled:	False
+-*dpmsStandby:		2:00:00
+-*dpmsSuspend:		2:00:00
+-*dpmsOff:		4:00:00
+-*grabDesktopImages:	True
++*dpmsStandby:		0:10:00
++*dpmsSuspend:		0:10:00
++*dpmsOff:		0:10:00
++*grabDesktopImages:	False
+ *grabVideoFrames:	False
+ *chooseRandomImages:	@[email protected]
+ ! This can be a local directory name, or the URL of an RSS or Atom feed.
+ *imageDirectory:	@[email protected]
+-*nice:			10
++*nice:			19
+ *memoryLimit:		0
+-*lock:			False
++*lock:			True
+ *verbose:		False
+ *timestamp:		True
+ *fade:			True
+ *unfade:		False
+ *fadeSeconds:		0:00:03
+ *fadeTicks:		20
+-*splash:		True
++*splash:		False
+ *splashDuration:	0:00:05
+ *visualID:		default
+ *captureStderr: 	True
+ *ignoreUninstalledPrograms: False
+ *authWarningSlack:	20
+ 
+-*textMode:		file
++*textMode:		date
+ *textLiteral:		XScreenSaver
+ *textFile:		@[email protected]
+-*textProgram:		fortune
+-*textURL:		https://en.wikipedia.org/w/index.php?title=Special:NewPages&feed=rss
++*textProgram:		date
++!*textURL:		https://en.wikipedia.org/w/index.php?title=Special:NewPages&feed=rss
++*textURL:		https://blogs.oracle.com/observatory/en_US/feed/entries/atom
+ 
+ *overlayTextForeground:	#FFFF00
+ *overlayTextBackground:	#000000
[email protected]@ -76,7 +77,7 @@
+ *procInterrupts:	True
+ 
+ ! Turning this on makes pointerHysteresis not work.
+-*xinputExtensionDev:	False
++*xinputExtensionDev:	True
+ 
+ ! Set this to True if you are experiencing longstanding XFree86 bug #421
+ ! (xscreensaver not covering the whole screen)
[email protected]@ -162,23 +163,23 @@ GetViewPortIsFullOfLies: False
+ @[email protected] GL: 				superquadrics -root			    \n\
+ 				attraction -root			    \n\
+ 				blitspin -root				    \n\
+-				greynetic -root				    \n\
+-				helix -root				    \n\
++-				greynetic -root				    \n\
++-				helix -root				    \n\
+ 				hopalong -root				    \n\
+ 				imsmap -root				    \n\
+ -				noseguy -root				    \n\
+ -				pyro -root				    \n\
+ 				qix -root				    \n\
+ -				rocks -root				    \n\
+-				rorschach -root				    \n\
++-				rorschach -root				    \n\
+ 				decayscreen -root			    \n\
+-				flame -root				    \n\
++-				flame -root				    \n\
+ 				halo -root				    \n\
+ 				slidescreen -root			    \n\
+-				pedal -root				    \n\
++-				pedal -root				    \n\
+ 				bouboule -root				    \n\
+ -				braid -root				    \n\
+-				coral -root				    \n\
++-				coral -root				    \n\
+ 				deco -root				    \n\
+ 				drift -root				    \n\
+ -				fadeplot -root				    \n\
[email protected]@ -187,13 +188,13 @@ GetViewPortIsFullOfLies: False
+ 				grav -root				    \n\
+ 				ifs -root				    \n\
+ @[email protected] GL: 				jigsaw -root				    \n\
+-				julia -root				    \n\
++-				julia -root				    \n\
+ -				kaleidescope -root			    \n\
+ @[email protected] GL: 				moebius -root				    \n\
+-				moire -root				    \n\
++-				moire -root				    \n\
+ @[email protected] GL: 				morph3d -root				    \n\
+ 				mountain -root				    \n\
+-				munch -root				    \n\
++-				munch -root				    \n\
+ 				penrose -root				    \n\
+ @[email protected] GL: 				pipes -root				    \n\
+ 				rd-bomb -root				    \n\
[email protected]@ -208,7 +209,7 @@ GetViewPortIsFullOfLies: False
+ 				xjack -root				    \n\
+ 				xlyap -root				    \n\
+ @[email protected] GL: 				atlantis -root				    \n\
+-				bsod -root				    \n\
++-				bsod -root				    \n\
+ @[email protected] GL: 				bubble3d -root				    \n\
+ @[email protected] GL: 				cage -root				    \n\
+ -				crystal -root				    \n\
[email protected]@ -221,7 +222,7 @@ GetViewPortIsFullOfLies: False
+ 				interference -root			    \n\
+ 				kumppa -root				    \n\
+ @[email protected] GL: 				lament -root				    \n\
+-				moire2 -root				    \n\
++-				moire2 -root				    \n\
+ @[email protected] GL: 				sonar -root				    \n\
+ @[email protected] GL: 				stairs -root				    \n\
+ 				truchet -root				    \n\
[email protected]@ -229,9 +230,9 @@ GetViewPortIsFullOfLies: False
+ 				blaster -root				    \n\
+ 				bumps -root				    \n\
+ 				ccurve -root				    \n\
+-				compass -root				    \n\
++-				compass -root				    \n\
+ 				deluxe -root				    \n\
+--				demon -root				    \n\
++				demon -root				    \n\
+ @[email protected] GL: 				extrusion -root				    \n\
+ -				loop -root				    \n\
+ 				penetrate -root				    \n\
[email protected]@ -245,7 +246,7 @@ GetViewPortIsFullOfLies: False
+ 				squiral -root				    \n\
+ 				wander -root				    \n\
+ -				webcollage -root			    \n\
+-				xflame -root				    \n\
++				xflame -root -bitmap /usr/lib/xscreensaver/config/unlock-logo.png \n\
+ 				xmatrix -root				    \n\
+ @[email protected] GL: 				gflux -root				    \n\
+ -				nerverot -root				    \n\
[email protected]@ -260,14 +261,14 @@ GetViewPortIsFullOfLies: False
+ @[email protected] GL: 				menger -root				    \n\
+ @[email protected] GL: 				molecule -root				    \n\
+ 				rotzoomer -root				    \n\
+-				speedmine -root				    \n\
++-				speedmine -root				    \n\
+ @[email protected] GL: 				starwars -root				    \n\
+ @[email protected] GL: 				stonerview -root			    \n\
+ 				vermiculate -root			    \n\
+ 				whirlwindwarp -root			    \n\
+ 				zoom -root				    \n\
+ 				anemone -root				    \n\
+-				apollonian -root			    \n\
++-				apollonian -root			    \n\
+ @[email protected] GL: 				boxed -root				    \n\
+ @[email protected] GL: 				cubenetic -root				    \n\
+ @[email protected] GL: 				endgame -root				    \n\
[email protected]@ -296,12 +297,11 @@ GetViewPortIsFullOfLies: False
+ @[email protected] GL: 				cubestorm -root				    \n\
+ 				eruption -root				    \n\
+ @[email protected] GL: 				flipflop -root				    \n\
[email protected][email protected] GL: 				flyingtoasters -root			    \n\
+ 				fontglide -root				    \n\
+ @[email protected] GL: 				gleidescope -root			    \n\
+ @[email protected] GL: 				glknots -root				    \n\
+ @[email protected] GL: 				glmatrix -root				    \n\
+-- GL: 				glslideshow -root			    \n\
[email protected][email protected] GL: 				glslideshow -root			    \n\
+ @[email protected] GL: 				hypertorus -root			    \n\
+ - GL: 				jigglypuff -root			    \n\
+ 				metaballs -root				    \n\
[email protected]@ -321,7 +321,6 @@ GetViewPortIsFullOfLies: False
+ 				intermomentary -root			    \n\
+ 				memscroller -root			    \n\
+ @[email protected] GL: 				noof -root				    \n\
+-				pacman -root				    \n\
+ @[email protected] GL: 				pinion -root				    \n\
+ @[email protected] GL: 				polyhedra -root				    \n\
+ - GL: 				providence -root			    \n\
[email protected]@ -468,7 +467,6 @@ XScreenSaver.bourneShell:		/bin/sh
+ *hacks.flipscreen3d.name:   FlipScreen3D
+ *hacks.fliptext.name:       FlipText
+ *hacks.fluidballs.name:     FluidBalls
+-*hacks.flyingtoasters.name: FlyingToasters
+ *hacks.fontglide.name:      FontGlide
+ *hacks.fuzzyflakes.name:    FuzzyFlakes
+ *hacks.geodesicgears.name:  GeodesicGears
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0002-GNOME-desktop-menu.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,59 @@
+From 71dcd92da3e21019bd224ca4c13aeb98109614eb Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 19:50:30 -0800
+Subject: [PATCH] GNOME desktop menu
+
+Changes needed for integration into GNOME desktop menus.
+Localized name & tooltips (Sun bug 5103358 / Oracle bug 15227916)
+
+Unknown why this differs from upstream - need to find out someday.
+---
+ driver/screensaver-properties.desktop.in | 34 ++++++++++++++++++++++++++++----
+ 1 file changed, 30 insertions(+), 4 deletions(-)
+
+diff --git a/driver/screensaver-properties.desktop.in b/driver/screensaver-properties.desktop.in
+index de42527..9b9dbe0 100644
+--- a/driver/screensaver-properties.desktop.in
++++ b/driver/screensaver-properties.desktop.in
[email protected]@ -1,8 +1,34 @@
+ [Desktop Entry]
+ Exec=xscreensaver-demo
+-Icon=xscreensaver
++Icon=gnome-ccscreensaver.png
+ Terminal=false
+-_Name=Screensaver
+-_Comment=Change screensaver properties
++Name=Screensaver
++Name[cs]=Spořič obrazovky
++Name[de]=Bildschirmschoner
++Name[es]=Salvapantallas
++Name[fr]=Économiseur d'écran
++Name[hu]=Képernyővédő
++Name[it]=Salvaschermo
++Name[ja]=スクリーンセーバー
++Name[ko]=화면 보호기
++Name[pt_BR]=Protetor de tela
++Name[sv]=Skärmsläckare
++Name[zh_CN]=屏幕保护程序
++Name[zh_HK]=螢幕保護程式
++Name[zh_TW]=螢幕保護程式
++Comment=Choose screensaver delay and appearance.
++Comment[cs]=Konfigurace nastavení spořiče obrazovky.
++Comment[de]=Bildschirmschonereinstellungen konfigurieren
++Comment[es]=Configura los valores del salvapantallas.
++Comment[fr]=Configurer les paramètres de l'économiseur d'écran.
++Comment[hu]=A képernyővédő beállításainak megváltoztatása
++Comment[it]=Configura le impostazioni del salvaschermo.
++Comment[ja]=スクリーンセーバーを設定
++Comment[ko]=화면 보호기 설정 구성
++Comment[pt_BR]=Definir as configurações do protetor de tela.
++Comment[sv]=Konfigurera inställningarna för skärmsläckaren.
++Comment[zh_CN]=配置屏幕保护程序的设置。
++Comment[zh_HK]=配置螢幕保護程式設定。
++Comment[zh_TW]=配置螢幕保護程式設定。
+ Type=Application
+-Categories=Settings;DesktopSettings;Security;X-XFCE;
++Categories=GNOME;Settings;Appearance;
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0003-Solaris-paths.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,324 @@
+From 45cdceb023897ee25d4d82434f570d63ccf43df8 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 19:59:16 -0800
+Subject: [PATCH] Solaris paths
+
+Various fixes to deal with where we install things on Solaris:
+
+- Only run hacks from the hacks dir, not $PATH
+
+- Find helper programs even though they are not in $PATH
+
+- Show author names when reading RSS feeds from sites like blogs.sun.com
+
+- Show Solaris package names in demo app when hacks are not installed
+
+- Use gnome-help to display man pages nicely, without requiring internet
+  access (which some customers at secure sites won't have configured),
+  instead of opening a web browser to view the man page at jwz.org or
+  opening a gnome-terminal to run the man command.
+
+Mostly not acceptable upstream.
+
+Backport notes: this change relies on the gnome-help version delivered in
+Solaris 11 that supports "man:xscreensaver" style URL's to display man pages.
+When backporting to Solaris 10 you will probably want to uncomment the
+lines shown for GNOME 2.4/2.6.
+
+Also, you'll need to fix the package names shown when the hacks are not
+installed to be the older SUNWxscreensaver-* for Solaris 10.
+---
+ driver/Makefile.in                 |  9 ++++---
+ driver/XScreenSaver.ad.in          | 14 +++++++---
+ driver/demo-Gtk.c                  |  4 +--
+ driver/subprocs.c                  | 54 ++++++++++++++++++++++++++++++++++++--
+ driver/xscreensaver-demo.glade2.in |  4 +--
+ driver/xscreensaver-text           |  6 ++++-
+ driver/xscreensaver.man            |  5 ++--
+ hacks/glx/Makefile.in              |  4 +--
+ 8 files changed, 81 insertions(+), 19 deletions(-)
+
+diff --git a/driver/Makefile.in b/driver/Makefile.in
+index c132304..a5b94bf 100644
+--- a/driver/Makefile.in
++++ b/driver/Makefile.in
[email protected]@ -27,7 +27,7 @@ INTLTOOL_MERGE	= @[email protected]
+ GTK_DATADIR	= @[email protected]
+ GTK_APPDIR	= $(GTK_DATADIR)/applications
+ GTK_ICONDIR	= $(GTK_DATADIR)/pixmaps
+-GTK_GLADEDIR	= $(GTK_DATADIR)/xscreensaver/glade
++GTK_GLADEDIR	= $(prefix)/lib/xscreensaver/config
+ HACK_CONF_DIR	= @[email protected]
+ 
+ CC		= @[email protected]
[email protected]@ -36,8 +36,11 @@ CFLAGS		= @[email protected]
+ LDFLAGS		= @[email protected]
+ DEFS		= @[email protected]
+ INTL_DEFS	= -DLOCALEDIR=\"$(localedir)\"
+-SUBP_DEFS	= $(DEFS) -DDEFAULT_PATH_PREFIX='"@[email protected]"'
+-GTK_DEFS	= $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"'
++SUBP_DEFS	= $(DEFS) -DHACK_PATH='"@[email protected]"' \
++	-DDEFAULT_PATH_PREFIX='"@[email protected]:$(libexecdir)"' \
++	-DHELPER_PATH='"$(libexecdir)"'
++GTK_DEFS	= $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' \
++			-DBINDIR='"$(bindir)"'
+ CONF_DEFS	= -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"'
+ 
+ LIBS		= @[email protected]
+diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in
+index 22d5bcb..3e1ff8a 100644
+--- a/driver/XScreenSaver.ad.in
++++ b/driver/XScreenSaver.ad.in
[email protected]@ -91,18 +91,24 @@ GetViewPortIsFullOfLies: False
+ 
+ ! This is the URL loaded by the "Help" button on the splash screen,
+ ! and by the "Documentation" menu item in xscreensaver-demo.
+-*helpURL: http://www.jwz.org/xscreensaver/man.html
++*helpURL: man:xscreensaver
+ 
+ ! loadURL       -- how the "Help" buttons load the helpURL (/bin/sh syntax.)
+ ! manualCommand -- how the "Documentation" buttons display man pages.
+ !
+ ! And there are so very many options to choose from!
+ !
++!   Modern GNOME:
++!
++*loadURL: gnome-help '%s'
++*manualCommand: gnome-help 'man:%s'
++!
+ !   Gnome 2.4, 2.6: (yelp can't display man pages, as of 2.6.3)
+ !
[email protected]@*loadURL: @[email protected] '%s'
[email protected]@*manualCommand: gnome-terminal --title '%s manual' \
[email protected]@		--command '/bin/sh -c "man %s; read foo"'
++!*loadURL: gnome-terminal --title 'xscreensaver manual' \
++!		--command '/bin/ksh -c "man xscreensaver; read foo"'
++!*manualCommand: gnome-terminal --title '%s manual' \
++!		--command '/bin/ksh -c "man %s; read foo"'
+ !
+ !   Gnome 2.2:
+ !
+diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
+index 27d2316..6c449f2 100644
+--- a/driver/demo-Gtk.c
++++ b/driver/demo-Gtk.c
[email protected]@ -994,7 +994,7 @@ restart_menu_cb (GtkWidget *widget, gpointer user_data)
+   flush_dialog_changes_and_save (s);
+   xscreensaver_command (GDK_DISPLAY(), XA_EXIT, 0, False, NULL);
+   sleep (1);
+-  if (system ("xscreensaver -nosplash &") < 0)
++  if (system (BINDIR "/xscreensaver -nosplash &") < 0)
+     fprintf (stderr, "%s: fork error\n", blurb());
+ 
+   await_xscreensaver (s);
[email protected]@ -4969,7 +4969,7 @@ main (int argc, char **argv)
+ 
+       if (init_results == 1)
+ 	{
+-	  system ("xscreensaver -nosplash &");
++	  system (BINDIR "/xscreensaver -nosplash &");
+ 	  return 0;
+ 	}
+ 
+diff --git a/driver/subprocs.c b/driver/subprocs.c
+index ecbaeb2..9414df1 100644
+--- a/driver/subprocs.c
++++ b/driver/subprocs.c
[email protected]@ -14,6 +14,7 @@
+ # include "config.h"
+ #endif
+ 
++#include <sys/stat.h>
+ #include <ctype.h>
+ #include <stdio.h>
+ #include <string.h>
[email protected]@ -799,6 +800,8 @@ print_path_error (const char *program)
+   free (cmd);
+   perror (buf);
+ 
++/* mali - security issue do not want to display user's path */
++#ifdef EXPOSE_USER_PATH
+   if (errno == ENOENT &&
+       (token = getenv("PATH")))
+     {
[email protected]@ -829,6 +832,7 @@ print_path_error (const char *program)
+         }
+       fprintf (stderr, "\n");
+     }
++#endif
+ }
+ 
+ 
[email protected]@ -885,12 +889,42 @@ fork_and_exec (saver_screen_info *ssi, const char *command)
+   return forked;
+ }
+ 
++static Bool
++check_if_hacks_dir_exists(Bool verbose_p)
++{
++  const char hackdir[] = HACK_PATH;
++
++  int status;
++  struct stat st;
++
++  status = stat (hackdir, &st);
++
++  if (status == 0 && S_ISDIR(st.st_mode))
++    {
++      return True;
++    }
++   else
++    {
++      if (verbose_p)
++       {
++         fprintf(stderr,
++                 "%s: Warning: dir: %s missing. Will not run hacks\n",
++                 blurb(), hackdir);
++       }
++      return False;
++    }
++}
+ 
+ void
+ spawn_screenhack (saver_screen_info *ssi)
+ {
+   saver_info *si = ssi->global;
+   saver_preferences *p = &si->prefs;
++  char* complete_hack_command;
++
++  if (si->prefs.verbose_p)
++   fprintf(stderr, "--> spawn_screenhack()\n");
++
+   XFlush (si->dpy);
+ 
+   if (!monitor_powered_on_p (si))
[email protected]@ -970,6 +1004,12 @@ spawn_screenhack (saver_screen_info *ssi)
+ 	    ;
+ 	}
+ 
++      if ((new_hack >= 0) &&
++         (check_if_hacks_dir_exists(p->verbose_p) == False))
++      {
++         new_hack = -1;
++      }
++
+       if (new_hack < 0)   /* don't run a hack */
+         {
+           ssi->current_hack = -1;
[email protected]@ -1017,7 +1057,17 @@ spawn_screenhack (saver_screen_info *ssi)
+       if (si->selection_mode < 0)
+ 	si->selection_mode = 0;
+ 
+-      forked = fork_and_exec (ssi, hack->command);
++      /* We need complete path to hack command else any executable
++       * with the same name in the path gets executed.
++       */
++      complete_hack_command = malloc (10 + strlen(hack->command) +
++                                             strlen (HACK_PATH));
++      sprintf(complete_hack_command, HACK_PATH"/%s", hack->command);
++
++
++      forked = fork_and_exec (ssi, complete_hack_command);
++      free (complete_hack_command);
++
+       switch ((int) forked)
+ 	{
+ 	case -1: /* fork failed */
[email protected]@ -1196,7 +1246,7 @@ get_best_gl_visual (saver_info *si, Screen *screen)
+   char *av[10];
+   int ac = 0;
+ 
+-  av[ac++] = "xscreensaver-gl-helper";
++  av[ac++] = HELPER_PATH "/xscreensaver-gl-helper";
+   av[ac] = 0;
+ 
+   if (pipe (fds))
+diff --git a/driver/xscreensaver-demo.glade2.in b/driver/xscreensaver-demo.glade2.in
+index ad0095d..40e47f6 100644
+--- a/driver/xscreensaver-demo.glade2.in
++++ b/driver/xscreensaver-demo.glade2.in
[email protected]@ -927,8 +927,8 @@ Installed</property>
+ 			      <property name="visible">True</property>
+ 			      <property name="label" translatable="yes">Very few (or no) screen savers appear to be available.
+ 
+-This probably means that the &quot;xscreensaver-extras&quot; and
+-&quot;xscreensaver-gl-extras&quot; packages are not installed.</property>
++This probably means that the “desktop/xscreensaver/hacks” and
++“desktop/xscreensaver/hacks/hacks-gl” packages are not installed.</property>
+ 			      <property name="use_underline">False</property>
+ 			      <property name="use_markup">False</property>
+ 			      <property name="justify">GTK_JUSTIFY_CENTER</property>
+diff --git a/driver/xscreensaver-text b/driver/xscreensaver-text
+index 8199829..921d5c7 100755
+--- a/driver/xscreensaver-text
++++ b/driver/xscreensaver-text
[email protected]@ -569,12 +569,15 @@ sub reformat_rss($) {
+     $i++;
+ 
+     my ($title, $body1, $body2, $body3);
++    my $author;
+     
+     $title = $3 if ([email protected]<((TITLE)       [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
+     $body1 = $3 if ([email protected]<((DESCRIPTION) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
+     $body2 = $3 if ([email protected]<((CONTENT)     [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
+     $body3 = $3 if ([email protected]<((SUMMARY)     [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
+ 
++    $author = $3 if ([email protected]<((DC:CREATOR) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
++
+     # If there are both <description> and <content> or <content:encoded>,
+     # use whichever one contains more text.
+     #
[email protected]@ -598,10 +601,11 @@ sub reformat_rss($) {
+ 
+     $title = rss_field_to_html ($title || '');
+     $body1 = rss_field_to_html ($body1 || '');
++    $author = rss_field_to_html ($author || '');
+ 
+     $title = '' if ($body1 eq $title);  # Identical in Twitter's atom feed.
+ 
+-    $out .= reformat_html ("$title<P>$body1", $wiki_p ? 'wiki' : 'rss');
++    $out .= reformat_html ("$title<BR>$author<P>$body1", $wiki_p ? 'wiki' : 'rss');
+     $out .= "\n";
+   }
+ 
+diff --git a/driver/xscreensaver.man b/driver/xscreensaver.man
+index 11f5b02..9ad7509 100644
+--- a/driver/xscreensaver.man
++++ b/driver/xscreensaver.man
[email protected]@ -97,9 +97,8 @@ xscreensaver-command -restart
+ If you want to set the system-wide defaults, then make your edits to
+ the xscreensaver app-defaults file, which should have been installed
+ when xscreensaver itself was installed.  The app-defaults file will
+-usually be named /usr/lib/X11/app-defaults/XScreenSaver, but different
+-systems might keep it in a different place (for example,
+-/usr/openwin/lib/app-defaults/XScreenSaver on Solaris.)
++usually be named /usr/share/X11/app-defaults/XScreenSaver, but different
++systems might keep it in a different place.
+ 
+ When settings are changed in the Preferences dialog box (see above)
+ the current settings will be written to the \fI.xscreensaver\fP file.
+diff --git a/hacks/glx/Makefile.in b/hacks/glx/Makefile.in
+index 211d356..23c68d4 100644
+--- a/hacks/glx/Makefile.in
++++ b/hacks/glx/Makefile.in
[email protected]@ -303,7 +303,7 @@ install-program:: $(EXES)
+ # the xscreensaver-gl-helper program, in $bindir
+ install-program:: $(EXES)
+ 	@exes="@[email protected]" ;					\
+-	 idir="$(install_prefix)$(bindir)" ;				\
++	 idir="$(install_prefix)$(libexecdir)" ;			\
+ 	 if [ "$$exes" != "" ]; then					\
+ 	   if [ ! -d $$idir ]; then					\
+ 	     $(INSTALL_DIRS) $$idir ;					\
[email protected]@ -372,7 +372,7 @@ uninstall-program::
+ # the xscreensaver-gl-helper program, in $bindir
+ uninstall-program::
+ 	@exes="$(GL_UTIL_EXES)" ;					\
+-	 idir="$(install_prefix)$(bindir)" ;				\
++	 idir="$(install_prefix)$(libexecdir)" ;			\
+ 	 for program in $$exes; do					\
+ 	   echo rm -f $$idir/$$program ;				\
+ 		rm -f $$idir/$$program ;				\
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0004-atoms.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,516 @@
+From 9bf12ae3168aa6f9234304a8a376d47962f0d589 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 20:11:05 -0800
+Subject: [PATCH] atoms
+
+Centralize atom handling and use XInternAtoms to get the atoms from
+the server in one round trip instead of a separate synchronous/blocking
+round trip for each XInternAtom individual call.
+
+Was offered upstream in 2011 - jwz responded with:
+  I'd sure like to see some kind of performance metrics -- like, any -- before
+  making a big change to something so central. When it comes to the xscreensaver
+  driver I'm a firm believer in "don't fix what ain't broke"...
+
+Need to find some time to actually measure that someday (dtrace?).
+---
+ driver/Makefile.in            |  14 +++---
+ driver/atoms.c                | 113 ++++++++++++++++++++++++++++++++++++++++++
+ driver/atoms.h                |  33 ++++++++++++
+ driver/demo-Gtk.c             |  26 +++-------
+ driver/demo-Xm.c              |  25 +++-------
+ driver/remote.c               |   4 +-
+ driver/windows.c              |   3 +-
+ driver/xscreensaver-command.c |  35 +++----------
+ driver/xscreensaver.c         |  47 ++++++------------
+ driver/xscreensaver.h         |   3 --
+ 10 files changed, 189 insertions(+), 114 deletions(-)
+ create mode 100644 driver/atoms.c
+ create mode 100644 driver/atoms.h
+
+diff --git a/driver/Makefile.in b/driver/Makefile.in
+index a5b94bf..90ef1d2 100644
+--- a/driver/Makefile.in
++++ b/driver/Makefile.in
[email protected]@ -188,18 +188,18 @@ SAVER_OBJS_1	= xscreensaver.o windows.o screens.o timers.o subprocs.o \
+ 		  exec.o xset.o splash.o setuid.o stderr.o mlstring.o
+ 
+ SAVER_SRCS	= $(SAVER_SRCS_1) prefs.c dpms.c $(LOCK_SRCS) \
+-		  $(SAVER_UTIL_SRCS) $(GL_SRCS)
++		  $(SAVER_UTIL_SRCS) $(GL_SRCS) atoms.c
+ SAVER_OBJS	= $(SAVER_OBJS_1) prefs.o dpms.o $(LOCK_OBJS) \
+-		  $(SAVER_UTIL_OBJS) $(GL_OBJS)
++		  $(SAVER_UTIL_OBJS) $(GL_OBJS) atoms.o
+ 
+-CMD_SRCS	= remote.c xscreensaver-command.c
+-CMD_OBJS	= remote.o xscreensaver-command.o
++CMD_SRCS	= remote.c atoms.c xscreensaver-command.c
++CMD_OBJS	= remote.o atoms.o xscreensaver-command.o
+ 
+ DEMO_SRCS_1	= prefs.c dpms.c
+ DEMO_OBJS_1	= prefs.o dpms.o
+ 
+-DEMO_SRCS	= $(DEMO_SRCS_1) remote.c exec.c $(DEMO_UTIL_SRCS)
+-DEMO_OBJS	= $(DEMO_OBJS_1) remote.o exec.o $(DEMO_UTIL_OBJS)
++DEMO_SRCS	= $(DEMO_SRCS_1) remote.c atoms.c exec.c $(DEMO_UTIL_SRCS)
++DEMO_OBJS	= $(DEMO_OBJS_1) remote.o atoms.o exec.o $(DEMO_UTIL_OBJS)
+ 
+ PDF2JPEG_SRCS	= pdf2jpeg.m
+ PDF2JPEG_OBJS	= pdf2jpeg.o
[email protected]@ -228,7 +228,7 @@ SCRIPTS		= $(SCRIPTS_1) @[email protected]
+ 
+ HDRS		= XScreenSaver_ad.h XScreenSaver_Xm_ad.h \
+ 		  xscreensaver.h prefs.h remote.h exec.h \
+-		  demo-Gtk-conf.h auth.h mlstring.h types.h
++		  demo-Gtk-conf.h auth.h mlstring.h types.h atoms.h
+ MEN_1		= xscreensaver.man xscreensaver-demo.man \
+ 		  xscreensaver-command.man \
+ 		  xscreensaver-text.man \
+diff --git a/driver/atoms.c b/driver/atoms.c
+new file mode 100644
+index 0000000..d50bc57
+--- /dev/null
++++ b/driver/atoms.c
[email protected]@ -0,0 +1,113 @@
++/* xscreensaver, Copyright (c) 1991-2010 Jamie Zawinski <[email protected]>
++ *
++ * Permission to use, copy, modify, distribute, and sell this software and its
++ * documentation for any purpose is hereby granted without fee, provided that
++ * the above copyright notice appear in all copies and that both that
++ * copyright notice and this permission notice appear in supporting
++ * documentation.  No representations are made about the suitability of this
++ * software for any purpose.  It is provided "as is" without express or
++ * implied warranty.
++ */
++
++#ifdef HAVE_CONFIG_H
++# include "config.h"
++#endif
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <sys/types.h>
++
++#include <X11/Xproto.h>		/* for CARD32 */
++#include <X11/Xlib.h>
++#include <X11/Xos.h>
++
++#include "atoms.h"
++
++/* Atoms to retrieve info from remote daemon */
++Atom XA_SCREENSAVER, XA_SCREENSAVER_ID, XA_SCREENSAVER_VERSION,
++   XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_STATUS;
++
++/* Atoms to send commands to remote daemon */
++Atom XA_ACTIVATE, XA_BLANK, XA_CYCLE, XA_DEACTIVATE, XA_DEMO,
++  XA_EXIT, XA_LOCK, XA_NEXT, XA_PREFS, XA_PREV, XA_RESTART,
++  XA_SELECT, XA_THROTTLE, XA_UNTHROTTLE;
++
++static const struct atom_request remote_control_atom_list[] =
++{
++    { &XA_SCREENSAVER, "SCREENSAVER" },
++    { &XA_SCREENSAVER_ID, "_SCREENSAVER_ID" },
++    { &XA_SCREENSAVER_VERSION, "_SCREENSAVER_VERSION" },
++    { &XA_SCREENSAVER_RESPONSE, "_SCREENSAVER_RESPONSE" },
++    { &XA_SCREENSAVER_STATUS, "_SCREENSAVER_STATUS" },
++    { &XA_ACTIVATE, "ACTIVATE" },
++    { &XA_BLANK, "BLANK" },
++    { &XA_CYCLE, "CYCLE" },
++    { &XA_DEACTIVATE, "DEACTIVATE" },
++    { &XA_DEMO, "DEMO" },
++    { &XA_EXIT, "EXIT" },
++    { &XA_LOCK, "LOCK" },
++    { &XA_NEXT, "NEXT" },
++    { &XA_PREFS, "PREFS" },
++    { &XA_PREV, "PREV" },
++    { &XA_RESTART, "RESTART" },
++    { &XA_SELECT, "SELECT" },
++    { &XA_THROTTLE, "THROTTLE" },
++    { &XA_UNTHROTTLE, "UNTHROTTLE" },
++    { NULL, NULL } /* Must be last to terminate list */
++};
++
++const struct atom_request *remote_control_atoms = remote_control_atom_list;
++
++/* Load a list of atoms in a single round trip to the X server instead of
++   waiting for a synchronous round trip for each and every atom */
++Status request_atoms ( Display *dpy,
++		       const struct atom_request **request_lists )
++{
++  int atom_count, n;
++  Status result;
++  const struct atom_request **l, *r;
++  Atom *atoms;
++  const char **names;
++
++  /* Count the number of items across all the lists passed in */
++  atom_count = 0;
++  for (l = request_lists; l != NULL && *l != NULL; l++)
++    {
++      for (r = *l; r != NULL && r->name != NULL; r++)
++	{
++	  atom_count++;
++	}
++    }
++
++  atoms = calloc(atom_count, sizeof(Atom));
++  names = calloc(atom_count, sizeof(char *));
++  if (!atoms || !names)
++    return -1;
++
++  n = 0;
++  for (l = request_lists; l != NULL && *l != NULL; l++)
++    {
++      for (r = *l; r != NULL && r->name != NULL; r++)
++	{
++	  names[n++] = r->name;
++	}
++    }
++  result = XInternAtoms( dpy, (char **) names, atom_count, False, atoms );
++
++  n = 0;
++  for (l = request_lists; l != NULL && *l != NULL; l++)
++    {
++      for (r = *l; r != NULL && r->name != NULL; r++)
++	{
++#if DEBUG_ATOMS
++	  fprintf (stderr, "atom: %s => %d\n", names[n], atoms[n]);
++#endif
++	  *(r->atomp) = atoms[n++];
++	}
++    }
++
++  free(atoms);
++  free(names);
++
++  return result;
++}
+diff --git a/driver/atoms.h b/driver/atoms.h
+new file mode 100644
+index 0000000..09e78f3
+--- /dev/null
++++ b/driver/atoms.h
[email protected]@ -0,0 +1,33 @@
++/* xscreensaver, Copyright (c) 1991-2010 Jamie Zawinski <[email protected]>
++ *
++ * Permission to use, copy, modify, distribute, and sell this software and its
++ * documentation for any purpose is hereby granted without fee, provided that
++ * the above copyright notice appear in all copies and that both that
++ * copyright notice and this permission notice appear in supporting
++ * documentation.  No representations are made about the suitability of this
++ * software for any purpose.  It is provided "as is" without express or
++ * implied warranty.
++ */
++
++#ifndef _XSCREENSAVER_ATOMS_H_
++#define _XSCREENSAVER_ATOMS_H_
++
++struct atom_request {
++    Atom *atomp;
++    const char *name;
++};
++
++extern const struct atom_request *remote_control_atoms;
++extern Status request_atoms ( Display *dpy,
++			      const struct atom_request **request_lists );
++
++/* Atoms to retrieve info from remote daemon */
++extern Atom XA_SCREENSAVER, XA_SCREENSAVER_ID, XA_SCREENSAVER_VERSION,
++  XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_STATUS;
++
++/* Atoms to send commands to remote daemon */
++extern Atom XA_ACTIVATE, XA_BLANK, XA_CYCLE, XA_DEACTIVATE, XA_DEMO,
++  XA_EXIT, XA_LOCK, XA_NEXT, XA_PREFS, XA_PREV, XA_RESTART,
++  XA_SELECT, XA_THROTTLE, XA_UNTHROTTLE;
++
++#endif /* _XSCREENSAVER_ATOMS_H_ */
+diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
+index 6c449f2..3fa27c3 100644
+--- a/driver/demo-Gtk.c
++++ b/driver/demo-Gtk.c
[email protected]@ -118,6 +118,7 @@
+ #include "resources.h"		/* for parse_time() */
+ #include "visual.h"		/* for has_writable_cells() */
+ #include "remote.h"		/* for xscreensaver_command() */
++#include "atoms.h"
+ #include "usleep.h"
+ 
+ #include "logo-50.xpm"
[email protected]@ -247,12 +248,6 @@ typedef struct {
+    a closure object of our own down into the various widget callbacks. */
+ static state *global_state_kludge;
+ 
+-Atom XA_VROOT;
+-Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION;
+-Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO;
+-Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT;
+-
+-
+ static void populate_demo_window (state *, int list_elt);
+ static void populate_prefs_page (state *);
+ static void populate_popup_window (state *);
[email protected]@ -5068,20 +5063,11 @@ main (int argc, char **argv)
+ 
+   /* Intern the atoms that xscreensaver_command() needs.
+    */
+-  XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
+-  XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
+-  XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
+-  XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
+-  XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
+-  XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
+-  XA_SELECT = XInternAtom (dpy, "SELECT", False);
+-  XA_DEMO = XInternAtom (dpy, "DEMO", False);
+-  XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
+-  XA_BLANK = XInternAtom (dpy, "BLANK", False);
+-  XA_LOCK = XInternAtom (dpy, "LOCK", False);
+-  XA_EXIT = XInternAtom (dpy, "EXIT", False);
+-  XA_RESTART = XInternAtom (dpy, "RESTART", False);
+-
++  {
++    const struct atom_request *atom_lists[2] = { NULL, NULL };
++    atom_lists[0] = remote_control_atoms;
++    request_atoms (dpy, atom_lists);
++  }
+ 
+   /* Create the window and all its widgets.
+    */
+diff --git a/driver/demo-Xm.c b/driver/demo-Xm.c
+index 56d1aac..a3e6567 100644
+--- a/driver/demo-Xm.c
++++ b/driver/demo-Xm.c
[email protected]@ -82,6 +82,7 @@
+ #include "resources.h"		/* for parse_time() */
+ #include "visual.h"		/* for has_writable_cells() */
+ #include "remote.h"		/* for xscreensaver_command() */
++#include "atoms.h"
+ #include "usleep.h"
+ 
+ #include <stdio.h>
[email protected]@ -110,12 +111,6 @@ extern const char *visual_menu[];
+ 
+ static char *short_version = 0;
+ 
+-Atom XA_VROOT;
+-Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION;
+-Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO;
+-Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT;
+-
+-
+ static void populate_demo_window (Widget toplevel,
+                                   int which, prefs_pair *pair);
+ static void populate_prefs_page (Widget top, prefs_pair *pair);
[email protected]@ -1791,19 +1786,11 @@ main (int argc, char **argv)
+ 
+   /* Intern the atoms that xscreensaver_command() needs.
+    */
+-  XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
+-  XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
+-  XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
+-  XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
+-  XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
+-  XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
+-  XA_SELECT = XInternAtom (dpy, "SELECT", False);
+-  XA_DEMO = XInternAtom (dpy, "DEMO", False);
+-  XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
+-  XA_BLANK = XInternAtom (dpy, "BLANK", False);
+-  XA_LOCK = XInternAtom (dpy, "LOCK", False);
+-  XA_EXIT = XInternAtom (dpy, "EXIT", False);
+-  XA_RESTART = XInternAtom (dpy, "RESTART", False);
++  {
++    const struct atom_request *atom_lists[2] = { NULL, NULL };
++    atom_lists[0] = remote_control_atoms;
++    request_atoms (dpy, atom_lists);
++  }
+ 
+   /* Create the window and all its widgets.
+    */
+diff --git a/driver/remote.c b/driver/remote.c
+index 775036a..59e30c1 100644
+--- a/driver/remote.c
++++ b/driver/remote.c
[email protected]@ -34,15 +34,13 @@
+ #include <X11/Xos.h>
+ 
+ #include "remote.h"
++#include "atoms.h"
+ 
+ #ifdef _VROOT_H_
+ ERROR! you must not include vroot.h in this file
+ #endif
+ 
+ extern char *progname;
+-extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE;
+-extern Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_EXIT;
+-extern Atom XA_VROOT, XA_SELECT, XA_DEMO, XA_BLANK, XA_LOCK;
+ 
+ 
+ static XErrorHandler old_handler = 0;
+diff --git a/driver/windows.c b/driver/windows.c
+index d33f251..6acaddb 100644
+--- a/driver/windows.c
++++ b/driver/windows.c
[email protected]@ -69,14 +69,13 @@ typedef long PROP32;
+ #include "xscreensaver.h"
+ #include "visual.h"
+ #include "fade.h"
++#include "atoms.h"
+ 
+ 
+ extern int kill (pid_t, int);		/* signal() is in sys/signal.h... */
+ 
+ Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
+ Atom XA_NET_WM_USER_TIME;
+-Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
+-Atom XA_SCREENSAVER_STATUS;
+ 
+ extern saver_info *global_si_kludge;	/* I hate C so much... */
+ 
+diff --git a/driver/xscreensaver-command.c b/driver/xscreensaver-command.c
+index 0057438..80b2813 100644
+--- a/driver/xscreensaver-command.c
++++ b/driver/xscreensaver-command.c
[email protected]@ -40,6 +40,7 @@
+ typedef long PROP32;
+ 
+ #include "remote.h"
++#include "atoms.h"
+ #include "version.h"
+ 
+ #ifdef _VROOT_H_
[email protected]@ -48,13 +49,6 @@ ERROR! you must not include vroot.h in this file
+ 
+ char *progname;
+ 
+-Atom XA_VROOT;
+-Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE;
+-Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO, XA_EXIT;
+-Atom XA_BLANK, XA_LOCK;
+-static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV;
+-static Atom XA_RESTART, XA_PREFS, XA_THROTTLE, XA_UNTHROTTLE;
+-
+ static char *screensaver_version;
+ # ifdef __GNUC__
+   __extension__   /* don't warn about "string length is greater than the
[email protected]@ -292,28 +286,11 @@ main (int argc, char **argv)
+       exit (1);
+     }
+ 
+-  XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
+-  XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
+-  XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
+-  XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
+-  XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
+-  XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
+-  XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
+-  XA_DEACTIVATE = XInternAtom (dpy, "DEACTIVATE", False);
+-  XA_RESTART = XInternAtom (dpy, "RESTART", False);
+-  XA_CYCLE = XInternAtom (dpy, "CYCLE", False);
+-  XA_NEXT = XInternAtom (dpy, "NEXT", False);
+-  XA_PREV = XInternAtom (dpy, "PREV", False);
+-  XA_SELECT = XInternAtom (dpy, "SELECT", False);
+-  XA_EXIT = XInternAtom (dpy, "EXIT", False);
+-  XA_DEMO = XInternAtom (dpy, "DEMO", False);
+-  XA_PREFS = XInternAtom (dpy, "PREFS", False);
+-  XA_LOCK = XInternAtom (dpy, "LOCK", False);
+-  XA_BLANK = XInternAtom (dpy, "BLANK", False);
+-  XA_THROTTLE = XInternAtom (dpy, "THROTTLE", False);
+-  XA_UNTHROTTLE = XInternAtom (dpy, "UNTHROTTLE", False);
+-
+-  XSync (dpy, 0);
++  {
++    const struct atom_request *atom_lists[2] = { NULL, NULL };
++    atom_lists[0] = remote_control_atoms;
++    request_atoms (dpy, atom_lists);
++  }
+ 
+   if (cmd == &XA_WATCH)
+     {
+diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
+index 45f0f0c..06f5c13 100644
+--- a/driver/xscreensaver.c
++++ b/driver/xscreensaver.c
[email protected]@ -232,6 +232,7 @@
+ #include "visual.h"
+ #include "usleep.h"
+ #include "auth.h"
++#include "atoms.h"
+ 
+ saver_info *global_si_kludge = 0;	/* I hate C so much... */
+ 
[email protected]@ -240,12 +241,6 @@ char *progclass = 0;
+ XrmDatabase db = 0;
+ 
+ 
+-static Atom XA_SCREENSAVER_RESPONSE;
+-static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV;
+-static Atom XA_RESTART, XA_SELECT;
+-static Atom XA_THROTTLE, XA_UNTHROTTLE;
+-Atom XA_DEMO, XA_PREFS, XA_EXIT, XA_LOCK, XA_BLANK;
+-
+ 
+ static XrmOptionDescRec options [] = {
+ 
[email protected]@ -667,31 +662,21 @@ connect_to_server (saver_info *si, int *argc, char **argv)
+ 
+   db = si->prefs.db;	/* resources.c needs this */
+ 
+-  XA_VROOT = XInternAtom (si->dpy, "__SWM_VROOT", False);
+-  XA_SCREENSAVER = XInternAtom (si->dpy, "SCREENSAVER", False);
+-  XA_SCREENSAVER_VERSION = XInternAtom (si->dpy, "_SCREENSAVER_VERSION",False);
+-  XA_SCREENSAVER_ID = XInternAtom (si->dpy, "_SCREENSAVER_ID", False);
+-  XA_SCREENSAVER_STATUS = XInternAtom (si->dpy, "_SCREENSAVER_STATUS", False);
+-  XA_SCREENSAVER_RESPONSE = XInternAtom (si->dpy, "_SCREENSAVER_RESPONSE",
+-					 False);
+-  XA_XSETROOT_ID = XInternAtom (si->dpy, "_XSETROOT_ID", False);
+-  XA_ESETROOT_PMAP_ID = XInternAtom (si->dpy, "ESETROOT_PMAP_ID", False);
+-  XA_XROOTPMAP_ID = XInternAtom (si->dpy, "_XROOTPMAP_ID", False);
+-  XA_NET_WM_USER_TIME = XInternAtom (si->dpy, "_NET_WM_USER_TIME", False);
+-  XA_ACTIVATE = XInternAtom (si->dpy, "ACTIVATE", False);
+-  XA_DEACTIVATE = XInternAtom (si->dpy, "DEACTIVATE", False);
+-  XA_RESTART = XInternAtom (si->dpy, "RESTART", False);
+-  XA_CYCLE = XInternAtom (si->dpy, "CYCLE", False);
+-  XA_NEXT = XInternAtom (si->dpy, "NEXT", False);
+-  XA_PREV = XInternAtom (si->dpy, "PREV", False);
+-  XA_SELECT = XInternAtom (si->dpy, "SELECT", False);
+-  XA_EXIT = XInternAtom (si->dpy, "EXIT", False);
+-  XA_DEMO = XInternAtom (si->dpy, "DEMO", False);
+-  XA_PREFS = XInternAtom (si->dpy, "PREFS", False);
+-  XA_LOCK = XInternAtom (si->dpy, "LOCK", False);
+-  XA_BLANK = XInternAtom (si->dpy, "BLANK", False);
+-  XA_THROTTLE = XInternAtom (si->dpy, "THROTTLE", False);
+-  XA_UNTHROTTLE = XInternAtom (si->dpy, "UNTHROTTLE", False);
++  {
++    const struct atom_request root_atoms[] =
++      {
++	{ &XA_VROOT, "__SWM_VROOT" },
++	{ &XA_XSETROOT_ID, "_XSETROOT_ID" },
++	{ &XA_ESETROOT_PMAP_ID, "ESETROOT_PMAP_ID" },
++	{ &XA_XROOTPMAP_ID, "_XROOTPMAP_ID" },
++	{ &XA_NET_WM_USER_TIME, "_NET_WM_USER_TIME" },
++	{ NULL, NULL } /* Must be last to terminate list */
++      };
++    const struct atom_request *atom_lists[3] = { NULL, NULL, NULL };
++    atom_lists[0] = remote_control_atoms;
++    atom_lists[1] = root_atoms;
++    request_atoms (si->dpy, atom_lists);
++  }
+ 
+   return toplevel_shell;
+ }
+diff --git a/driver/xscreensaver.h b/driver/xscreensaver.h
+index d67966e..064e9c4 100644
+--- a/driver/xscreensaver.h
++++ b/driver/xscreensaver.h
[email protected]@ -202,8 +202,5 @@ Bool safe_XF86VidModeGetViewPort (Display *, int, int *, int *);
+ 
+ extern Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
+ extern Atom XA_NET_WM_USER_TIME;
+-extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
+-extern Atom XA_SCREENSAVER_STATUS, XA_LOCK, XA_BLANK;
+-extern Atom XA_DEMO, XA_PREFS;
+ 
+ #endif /* __XSCREENSAVER_H__ */
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0005-gtk-lock.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,4062 @@
+From 7420325ce7eb36c5441094463f1f7ebe6623d222 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 20:36:57 -0800
+Subject: [PATCH] gtk-lock
+
+Solaris uses the gtk unlock dialog program originally written by
+Ximian & Wipro, in order to provide a dialog box that works with
+the GNOME accessibility framework.   This was done as a fork of
+the original xscreensaver because the maintainer would not allow
+use of a toolkit in the lock dialog - he has since softened his
+stance a bit, but this has not been presented to him to see if it
+meets his requirements as spelled out at:
+        http://www.jwz.org/xscreensaver/toolkits.html
+
+This patch also contains fixes for:
+
+15134570 SUNBT4782515 user is prompted to enter PIN or password when screen
+	 	      is locked
+15134983 SUNBT4783832 No date on xscreensaver-lock and warning on screen
+15179562 SUNBT4931584 xscreensaver-demo cores with GTK_MODULES=gail:atk-bridge
+15209082 SUNBT5039876 "User:" should not look like an input field
+15209083 SUNBT5039878 "Password:" field should be focused / have flashing caret
+15214348 SUNBT5059445 pam service name, screen kb and screen reader support
+15220008 SUNBT5077989 Bug 147580: password input dialogue obscures GOK
+15220010 SUNBT5077993 Bug 147639: Gok cant automatically UI grab screensaver
+	 	      preferences
+15220705 SUNBT5079870 147587: password field should set ATK_ROLE_PASSWORD_TEXT
+15221761 SUNBT5083155 Unable to unlock screen when running dual head
+	 	      magnification
+15231258 SUNBT6176524 passwdTimeoutEnable for disabled user (xscreensaver-lock)
+15231818 SUNBT6178584 Xscreensaver needs to use ROLE_PASSWORD_TEXT
+15233078 SUNBT6182506 Screensaver dialog isn't magnified properly
+15239418 SUNBT6203951 xscreensaver lockscreen translation errors for fr_FR
+15252945 SUNBT6237901 Ldap and Gnome xscreensaver authentication failure
+15265442 SUNBT6269444 snv_14 xscreensaver prints out gratuitous debug messages
+	 	      after authentication
+15280862 SUNBT6308859 xscreensaver: password lock dialog is not localized
+15295912 SUNBT6346056 xscreensaver should not enable input method
+15317555 SUNBT6395649 at-spi-registryd starts when screen is locked even when
+	 	      accessible device support is off
+15326852 SUNBT6417168 xscreensaver loops while trying to unlock a session for
+	 	      a user whose password was expired
+15346556 SUNBT6461887 GNOME screen lock does not prevent access to other
+	 	      applications via 'alt-tab'
+15352585 SUNBT6475285 xscreensaver core dumps in kill_job() after unlocking
+	 	      the screen
+15354012 SUNBT6478362 When the AT support is enabled, the input focus is
+	 	      located at password label
+15356879 SUNBT6484604 X should stop linking against -lcmd
+15375976 SUNBT6520014 possible mem. leak in xscreensaver's lock.c in s11/nv
+15387793 SUNBT6541240 Screen saver will lock user out of the system if they
+	 	      have no password set
+15405753 SUNBT6573182 after applying patch 120094-11(or later), xscreensaver
+	 	      core dump
+15427168 SUNBT6611183 xscreensaver needs to put Sun logos in files loaded at
+	 	      runtime
+15461985 SUNBT6670025 xscreensaver passwd dialog image missing in nv_85
+15462355 SUNBT6670659 password dialog window remains on the screen even after
+	 	      screen is unlocked
+15463666 SUNBT6673036 prepare for Indiana unlock logos
+15500787 SUNBT6736157 Security problem when desktop a11y support is turned on
+15521700 SUNBT6769901 popup windows appearing through xscreensaver
+15553552 SUNBT6825374 xscreensaver issues under Xorg
+15561643 SUNBT6839026 Regression in screensaver may cause Performance
+	 	      Degradation and make locked screensaver unresponsive
+15565807 SUNBT6845751 xscreensaver-lock chews CPU when daemon dies while unlock
+	 	      dialog is up
+15568147 SUNBT6849124 xscreensaver leaves a dialog that cannot be moved/closed
+	 	      after password change warning
+15573881 SUNBT6857559 Nevada build was broken because of 6849124
+15652522 SUNBT6964562 xscreensaver dumps core whenever it unlocks in svn-142
+15700093 SUNBT7023648 xscreensaver does not allow user to enter password
+	 	      and login w/ sv_SE.ISO8859-01/-15
+22706313 xscreensaver calls to pam_setcred with the wrong flag
+---
+ config.h.in           |    3 +
+ configure.in          |   27 +-
+ driver/Makefile.in    |   59 ++-
+ driver/auth.h         |    4 +
+ driver/demo-Gtk.c     |   18 +
+ driver/dialog-data.h  |  131 ++++++
+ driver/lock-Gtk.c     |  968 +++++++++++++++++++++++++++++++++++++++++++
+ driver/lock.c         | 1085 ++++++++++++++++++++++++++++++++++++++++++++-----
+ driver/passwd-pam.c   |  228 +++++++++--
+ driver/passwd.c       |    1 +
+ driver/setuid.c       |    5 +-
+ driver/subprocs.c     |   35 +-
+ driver/timers.c       |  110 ++++-
+ driver/types.h        |   18 +
+ driver/windows.c      |   21 +-
+ driver/xscreensaver.c |  130 +++++-
+ driver/xscreensaver.h |    6 +
+ 17 files changed, 2687 insertions(+), 162 deletions(-)
+ create mode 100644 driver/dialog-data.h
+ create mode 100644 driver/lock-Gtk.c
+
+diff --git a/config.h.in b/config.h.in
+index 3524ec4..6b6d077 100644
+--- a/config.h.in
++++ b/config.h.in
[email protected]@ -360,6 +360,9 @@
+    make use of this if it is available. */
+ #undef HAVE_XPM
+ 
++/* Define this to build the external lock dialog */
++#undef HAVE_XSCREENSAVER_LOCK
++
+ /* Define this if you have the X Shared Memory Extension. */
+ #undef HAVE_XSHM_EXTENSION
+ 
+diff --git a/configure.in b/configure.in
+index 4c4dee5..873299e 100644
+--- a/configure.in
++++ b/configure.in
[email protected]@ -2666,6 +2666,7 @@ if test "$with_gtk" = yes; then
+   pkg_check_version        libglade-2.0  1.99.0
+   pkg_check_version      gdk-pixbuf-2.0  2.0.0
+   pkg_check_version gdk-pixbuf-xlib-2.0  2.0.0
++  pkg_check_version           gconf-2.0  2.6.1
+   have_gtk="$ok"
+ 
+   if test "$have_gtk" = no; then
[email protected]@ -2681,6 +2682,14 @@ if test "$with_gtk" = yes; then
+   fi
+ 
+   if test "$have_gtk" = yes; then
++#--- Begin SUNW addition
++    PKG_CHECK_MODULES([LOGINHELPER], [libloginhelper-1.0 >= 1.0],
++        [pkgs="$pkgs libloginhelper-1.0"
++         AC_DEFINE([HAVE_LOGINHELPER],[],
++                   [Define this to use libloginhelper (atk 1.x only)])],
++        [true])
++    AC_DEFINE(HAVE_XSCREENSAVER_LOCK,[],[Define this to build the external lock dialog])
++#--- End SUNW addition
+     AC_CACHE_CHECK([for Gtk includes], ac_cv_gtk_config_cflags,
+                    [ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`])
+     AC_CACHE_CHECK([for Gtk libs], ac_cv_gtk_config_libs,
[email protected]@ -3933,6 +3942,16 @@ if test "$have_gtk" = yes; then
+   ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
+ fi
+ 
++#--- Begin SUNW addition
++PREFERRED_LOCK_PROGRAM=
++ALL_LOCK_PROGRAMS=
++LOCK_PROGRAM=
++if test "$have_gtk" = yes; then
++  PREFERRED_LOCK_PROGRAM=xscreensaver-lock-Gtk
++  ALL_LOCK_PROGRAMS="$PREFERRED_LOCK_PROGRAM $ALL_LOCK_PROGRAMS"
++  LOCK_PROGRAM=xscreensaver-lock
++fi
++#--- End SUNW addition
+ 
+ if test "$have_kerberos" = yes; then
+   PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)"
[email protected]@ -4077,6 +4096,11 @@ AC_SUBST(INCLUDES)
+ 
+ AC_SUBST(PREFERRED_DEMO_PROGRAM)
+ AC_SUBST(ALL_DEMO_PROGRAMS)
++#--- Begin SUNW addition
++AC_SUBST(PREFERRED_LOCK_PROGRAM)
++AC_SUBST(ALL_LOCK_PROGRAMS)
++AC_SUBST(LOCK_PROGRAM)
++#--- End SUNW addition
+ AC_SUBST(SAVER_LIBS)
+ AC_SUBST(MOTIF_LIBS)
+ AC_SUBST(GTK_LIBS)
[email protected]@ -4598,7 +4622,8 @@ HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed '[email protected]/[email protected]@;[email protected]//*@/@g'`
+ 
+ 
+ # Sanity check the hackdir
+-for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command ; do
++# SUNW addition: added xscreensaver-lock to list on next line
++for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command xscreensaver-lock ; do
+   if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then
+     echo ""
+     AC_MSG_ERROR([\"--with-hackdir=${bindir}/${bad_choice}\" won't work.
+diff --git a/driver/Makefile.in b/driver/Makefile.in
+index 90ef1d2..a44e312 100644
+--- a/driver/Makefile.in
++++ b/driver/Makefile.in
[email protected]@ -29,6 +29,7 @@ GTK_APPDIR	= $(GTK_DATADIR)/applications
+ GTK_ICONDIR	= $(GTK_DATADIR)/pixmaps
+ GTK_GLADEDIR	= $(prefix)/lib/xscreensaver/config
+ HACK_CONF_DIR	= @[email protected]
++LOCK_DIR	= $(libexecdir)
+ 
+ CC		= @[email protected]
+ OBJCC		= @[email protected]
[email protected]@ -42,6 +43,7 @@ SUBP_DEFS	= $(DEFS) -DHACK_PATH='"@[email protected]"' \
+ GTK_DEFS	= $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' \
+ 			-DBINDIR='"$(bindir)"'
+ CONF_DEFS	= -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"'
++LOCK_DEFS	= $(DEFS) -DLOCKDIR=\"$(LOCK_DIR)\"
+ 
+ LIBS		= @[email protected]
+ INTL_LIBS	= @[email protected]
[email protected]@ -98,6 +100,8 @@ MOTIF_OBJS	= demo-Xm.o demo-Xm-widgets.o
+ 
+ GTK_SRCS	= demo-Gtk.c demo-Gtk-conf.c
+ GTK_OBJS	= demo-Gtk.o demo-Gtk-conf.o @[email protected]
++GTK_LOCK_SRCS	= lock-Gtk.c atoms.c remote.c
++GTK_LOCK_OBJS	= lock-Gtk.o atoms.o remote.o
+ 
+ PWENT_SRCS	= passwd-pwent.c
+ PWENT_OBJS	= passwd-pwent.o
[email protected]@ -217,8 +221,8 @@ GETIMG_LIBS	= $(LIBS) $(X_LIBS) $(XPM_LIBS) $(JPEG_LIBS) \
+ 		  $(X_PRE_LIBS) -lXt -lX11 $(XMU_LIBS) -lXext $(X_EXTRA_LIBS)
+ 
+ EXES		= xscreensaver xscreensaver-command xscreensaver-demo \
+-		  xscreensaver-getimage @[email protected]
+-EXES2		= @[email protected]
++		  xscreensaver-getimage @[email protected] @[email protected]
++EXES2		= @[email protected] @[email protected]
+ EXES_OSX	= pdf2jpeg
+ 
+ SCRIPTS_1	= xscreensaver-getimage-file xscreensaver-getimage-video \
[email protected]@ -247,7 +251,7 @@ VMSFILES	= compile_axp.com compile_decc.com link_axp.com link_decc.com \
+ 		  vms-getpwnam.c vms-pwd.h vms-hpwd.c vms-validate.c \
+ 		  vms_axp.opt vms_axp_12.opt vms_decc.opt vms_decc_12.opt
+ 
+-TARFILES	= $(EXTRAS) $(VMSFILES) $(SAVER_SRCS_1) \
++TARFILES	= $(EXTRAS) $(VMSFILES) $(SAVER_SRCS_1) $(GTK_LOCK_SRCS) \
+ 		  $(MOTIF_SRCS) $(GTK_SRCS) $(PWENT_SRCS) $(PWHELPER_SRCS) \
+ 		  $(KERBEROS_SRCS) $(PAM_SRCS) $(LOCK_SRCS_1) $(DEMO_SRCS_1) \
+ 		  $(CMD_SRCS) $(GETIMG_SRCS_1) $(PDF2JPEG_SRCS) $(HDRS) \
[email protected]@ -260,7 +264,7 @@ all: $(EXES) $(EXES2)
+ tests: $(TEST_EXES)
+ 
+ install:   install-program   install-ad    install-scripts \
+-	   install-gnome     install-man   install-xml install-pam
++	   install-gnome     install-man   install-xml
+ uninstall: uninstall-program uninstall-ad  \
+ 	   uninstall-gnome   uninstall-man uninstall-xml  
+ 
[email protected]@ -272,6 +276,9 @@ install-program: $(EXES)
+ 	@if [ ! -d $(install_prefix)$(bindir) ]; then			\
+ 	  $(INSTALL_DIRS) $(install_prefix)$(bindir) ;			\
+ 	 fi
++	@if [ -n "@[email protected]" -a ! -d $(install_prefix)$(LOCK_DIR) ]; then \
++	  $(INSTALL_DIRS) $(install_prefix)$(LOCK_DIR) ; 		\
++	 fi
+ 	@inst="$(INSTALL_PROGRAM)" ;					\
+ 	if [ @[email protected] = yes ]; then				\
+ 	   me=`PATH="$$PATH:/usr/ucb" whoami` ;				\
[email protected]@ -300,6 +307,12 @@ install-program: $(EXES)
+ 	  echo $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \
+ 	       $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \
+ 	 done
++	@if [ -n "@[email protected]" ]; then				     \
++	  echo $(INSTALL_PROGRAM) xscreensaver-lock \
++	    $(install_prefix)$(LOCK_DIR)/xscreensaver-lock ; \
++	   $(INSTALL_PROGRAM) xscreensaver-lock \
++	    $(install_prefix)$(LOCK_DIR)/xscreensaver-lock ; \
++	fi
+ 
+ install-ad: XScreenSaver.ad
+ 	@if [ ! -d $(install_prefix)$(AD_DIR) ]; then			      \
[email protected]@ -736,7 +749,7 @@ $(SAVER_UTIL_OBJS):
+ 
+ # How we build object files in this directory.
+ .c.o:
+-	$(CC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) $<
++	$(CC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(INTL_DEFS) $(CFLAGS) $(X_CFLAGS) $<
+ 
+ .m.o:
+ 	$(OBJCC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) $<
[email protected]@ -762,6 +775,16 @@ demo-Gtk-conf.o: demo-Gtk-conf.c
+ 	$(CC) -c $(INCLUDES) $(CONF_DEFS) $(GTK_DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \
+ 	  $(srcdir)/demo-Gtk-conf.c
+ 
++# lock takes an extra -D option.
++lock.o:
++	$(CC) -c $(INCLUDES) $(LOCK_DEFS) $(CFLAGS) $(X_CFLAGS) \
++	  $(srcdir)/lock.c
++
++# lock-Gtk takes extra -D and -I options.
++lock-Gtk.o: lock-Gtk.c
++	$(CC) -c $(INCLUDES) -I$(ICON_SRC) $(GTK_DEFS) \
++	  $(CFLAGS) $(X_CFLAGS) $(INTL_DEFS) \
++	  $(srcdir)/lock-Gtk.c
+ 
+ # How we build the default app-defaults file into the program.
+ #
[email protected]@ -776,7 +799,8 @@ XScreenSaver_Xm_ad.h: XScreenSaver-Xm.ad
+ # The executables linked in this directory.
+ #
+ xscreensaver: $(SAVER_OBJS)
+-	$(CC) $(LDFLAGS) -o [email protected] $(SAVER_OBJS) $(SAVER_LIBS) $(INTL_LIBS)
++	$(CC) $(LDFLAGS) -o [email protected] $(SAVER_OBJS) $(SAVER_LIBS) $(INTL_LIBS) \
++	-lgconf-2 -lgobject-2.0 -lglib-2.0
+ 
+ xscreensaver-command: $(CMD_OBJS)
+ 	$(CC) $(LDFLAGS) -o [email protected] $(CMD_OBJS) $(CMD_LIBS)
[email protected]@ -792,6 +816,15 @@ xscreensaver-demo: @[email protected]
+ 	       cp -p @[email protected]@[email protected] [email protected]@[email protected]      ;	\
+ 	fi
+ 
++xscreensaver-lock: @[email protected]
++	$(INSTALL_PROGRAM) @[email protected] [email protected]
++
++xscreensaver-lock-Gtk: $(GTK_LOCK_OBJS)
++	$(CC) $(LDFLAGS) -o [email protected] $(GTK_LOCK_OBJS) $(LIBS) $(X_LIBS) \
++	$(GTK_LIBS) $(XML_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
++	$(XDPMS_LIBS) -lXext \
++	$(X_EXTRA_LIBS)
++
+ xscreensaver-demo-Xm: $(DEMO_OBJS) $(MOTIF_OBJS)
+ 	$(CC) $(LDFLAGS) -o [email protected] $(DEMO_OBJS) $(MOTIF_OBJS) $(LIBS) $(X_LIBS) \
+ 	$(MOTIF_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) -lXt -lX11 \
[email protected]@ -815,7 +848,7 @@ pdf2jpeg: $(PDF2JPEG_OBJS)
+ 
+ 
+ TEST_PASSWD_OBJS = test-passwd.o $(LOCK_OBJS_1) $(PASSWD_OBJS) \
+-	 subprocs.o setuid.o splash.o prefs.o mlstring.o exec.o \
++	 subprocs.o setuid.o splash.o prefs.o mlstring.o \
+ 	$(SAVER_UTIL_OBJS)
+ test-passwd.o: XScreenSaver_ad.h
+ 
[email protected]@ -897,8 +930,14 @@ dpms.o: $(srcdir)/types.h
+ dpms.o: $(srcdir)/xscreensaver.h
+ exec.o: ../config.h
+ exec.o: $(srcdir)/exec.h
++lock-Gtk.o: $(srcdir)/atoms.h
++lock-Gtk.o: ../config.h
++lock-Gtk.o: $(srcdir)/remote.h
++lock-Gtk.o: $(UTILS_SRC)/xscreensaver-intl.h
+ lock.o: $(srcdir)/auth.h
+ lock.o: ../config.h
++lock.o: $(srcdir)/dialog-data.h
++lock.o: $(srcdir)/exec.h
+ lock.o: $(srcdir)/mlstring.h
+ lock.o: $(srcdir)/prefs.h
+ lock.o: $(srcdir)/types.h
[email protected]@ -907,6 +946,8 @@ lock.o: $(srcdir)/xscreensaver.h
+ mlstring.o: $(srcdir)/mlstring.h
+ passwd.o: $(srcdir)/auth.h
+ passwd.o: ../config.h
++passwd.o: $(srcdir)/dialog-data.h
++passwd.o: $(srcdir)/mlstring.h
+ passwd.o: $(srcdir)/prefs.h
+ passwd.o: $(srcdir)/types.h
+ passwd.o: $(srcdir)/xscreensaver.h
[email protected]@ -975,6 +1016,8 @@ test-vp.o: ../config.h
+ test-xdpms.o: ../config.h
+ test-xinerama.o: ../config.h
+ timers.o: ../config.h
++timers.o: $(srcdir)/dialog-data.h
++timers.o: $(srcdir)/mlstring.h
+ timers.o: $(srcdir)/prefs.h
+ timers.o: $(srcdir)/types.h
+ timers.o: $(srcdir)/xscreensaver.h
[email protected]@ -1002,6 +1045,8 @@ xscreensaver-getimage.o: $(UTILS_SRC)/yarandom.h
+ xscreensaver.o: XScreenSaver_ad.h
+ xscreensaver.o: $(srcdir)/auth.h
+ xscreensaver.o: ../config.h
++xscreensaver.o: $(srcdir)/dialog-data.h
++xscreensaver.o: $(srcdir)/mlstring.h
+ xscreensaver.o: $(srcdir)/prefs.h
+ xscreensaver.o: $(srcdir)/types.h
+ xscreensaver.o: $(UTILS_SRC)/resources.h
+diff --git a/driver/auth.h b/driver/auth.h
+index 65e00f3..4fcbb34 100644
+--- a/driver/auth.h
++++ b/driver/auth.h
[email protected]@ -51,4 +51,8 @@ xss_authenticate(saver_info *si, Bool verbose_p);
+ void
+ auth_finished_cb (saver_info *si);
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++extern int write_to_child (saver_info* si, const char* cmd, const char *msg);
++#endif
++
+ #endif
+diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
+index 3fa27c3..ece3c44 100644
+--- a/driver/demo-Gtk.c
++++ b/driver/demo-Gtk.c
[email protected]@ -98,6 +98,8 @@
+ # define G_MODULE_EXPORT /**/
+ #endif /* !HAVE_GTK2 */
+ 
++#include <gconf/gconf-client.h>
++
+ #if defined(DEFAULT_ICONDIR) && !defined(GLADE_DIR)
+ # define GLADE_DIR DEFAULT_ICONDIR
+ #endif
[email protected]@ -5042,6 +5044,22 @@ main (int argc, char **argv)
+   load_init_file (dpy, p);
+   initialize_sort_map (s);
+ 
++  /* Bug 147639: Gok cant automatically UI grab screensaver preferences */
++  {
++    GConfClient *client = gconf_client_get_default ();
++
++#define KEY "/desktop/gnome/interface/accessibility"
++
++    /* check if accessibilty mode is enabled */
++    if (gconf_client_get_bool (client, KEY, NULL))
++      {
++	/* GTK Accessibility Module initialized */
++	const char *modulesptr = g_getenv ("GTK_MODULES");
++	if (!modulesptr || (modulesptr [0] == '\0'))
++	  putenv ("GTK_MODULES=gail:atk-bridge");
++      }
++  }
++
+   /* Now that Xt has been initialized, and the resources have been read,
+      we can set our `progname' variable to something more in line with
+      reality.
+diff --git a/driver/dialog-data.h b/driver/dialog-data.h
+new file mode 100644
+index 0000000..1a6a965
+--- /dev/null
++++ b/driver/dialog-data.h
[email protected]@ -0,0 +1,131 @@
++/* xscreensaver, Copyright (c) 1993-2008 Jamie Zawinski <[email protected]>
++ *
++ * Permission to use, copy, modify, distribute, and sell this software and its
++ * documentation for any purpose is hereby granted without fee, provided that
++ * the above copyright notice appear in all copies and that both that
++ * copyright notice and this permission notice appear in supporting
++ * documentation.  No representations are made about the suitability of this
++ * software for any purpose.  It is provided "as is" without express or
++ * implied warranty.
++ */
++
++#ifndef __DIALOG_DATA_H__
++#define __DIALOG_DATA_H__
++
++#include <stdio.h>
++#include "types.h"
++#include "mlstring.h"
++
++#define MAX_BYTES_PER_CHAR 8	/* UTF-8 uses no more than 3, I think */
++#define MAX_PASSWD_CHARS   128	/* Longest possible passphrase */
++
++struct passwd_dialog_data {
++
++  saver_screen_info *prompt_screen;
++  int previous_mouse_x, previous_mouse_y;
++
++  /* "Characters" in the password may be a variable number of bytes long.
++     typed_passwd contains the raw bytes.
++     typed_passwd_char_size indicates the size in bytes of each character,
++     so that we can make backspace work.
++   */
++  char typed_passwd [MAX_PASSWD_CHARS * MAX_BYTES_PER_CHAR];
++  char typed_passwd_char_size [MAX_PASSWD_CHARS];
++
++  XtIntervalId timer;
++  int i_beam;
++
++  float ratio;
++  Position x, y;
++  Dimension width;
++  Dimension height;
++  Dimension border_width;
++
++  Bool echo_input;
++  Bool show_stars_p; /* "I regret that I have but one asterisk for my country."
++                        -- Nathan Hale, 1776. */
++
++  char *heading_label;
++  char *body_label;
++  char *user_label;
++  mlstring *info_label;
++  /* The entry field shall only be displayed if prompt_label is not NULL */
++  mlstring *prompt_label;
++  char *date_label;
++  char *passwd_string;
++  Bool passwd_changed_p; /* Whether the user entry field needs redrawing */
++  Bool caps_p;           /* Whether we saw a keypress with caps-lock on */
++  char *unlock_label;
++  char *login_label;
++  char *uname_label;
++
++  Bool show_uname_p;
++
++#ifndef HAVE_XSCREENSAVER_LOCK
++  XFontStruct *heading_font;
++  XFontStruct *body_font;
++  XFontStruct *label_font;
++  XFontStruct *passwd_font;
++  XFontStruct *date_font;
++  XFontStruct *button_font;
++  XFontStruct *uname_font;
++
++  Pixel foreground;
++  Pixel background;
++  Pixel border;
++  Pixel passwd_foreground;
++  Pixel passwd_background;
++  Pixel thermo_foreground;
++  Pixel thermo_background;
++  Pixel shadow_top;
++  Pixel shadow_bottom;
++  Pixel button_foreground;
++  Pixel button_background;
++
++  Dimension preferred_logo_width, logo_width;
++  Dimension preferred_logo_height, logo_height;
++  Dimension thermo_width;
++  Dimension internal_border;
++  Dimension shadow_width;
++
++  Dimension passwd_field_x, passwd_field_y;
++  Dimension passwd_field_width, passwd_field_height;
++
++  Dimension unlock_button_x, unlock_button_y;
++  Dimension unlock_button_width, unlock_button_height;
++
++  Dimension login_button_x, login_button_y;
++  Dimension login_button_width, login_button_height;
++
++  Dimension thermo_field_x, thermo_field_y;
++  Dimension thermo_field_height;
++
++  Pixmap logo_pixmap;
++  Pixmap logo_clipmask;
++  int logo_npixels;
++  unsigned long *logo_pixels;
++#endif /* ! HAVE_XSCREENSAVER_LOCK */
++
++  Cursor passwd_cursor;
++  Bool unlock_button_down_p;
++  Bool login_button_down_p;
++  Bool login_button_p;
++  Bool login_button_enabled_p;
++  Bool button_state_changed_p; /* Refers to both buttons */
++
++  Pixmap save_under;
++  Pixmap user_entry_pixmap;
++
++#ifdef HAVE_XSCREENSAVER_LOCK
++  /* extern passwd dialog stuff */
++  XtInputId stdout_input_id;
++  int       stdin_fd;    /* child's stdin - parent writes to this */
++  int       stdout_fd;   /* child's stdout - parent reads from this */
++  FILE     *stdin_file;  /* child's stdin - parent writes to this */
++  FILE     *stdout_file; /* child's stdout - parent reads from this */
++  Bool      got_windowid;
++  Bool      got_passwd;
++#endif
++};
++
++#endif /* __DIALOG_DATA_H__ */
+diff --git a/driver/lock-Gtk.c b/driver/lock-Gtk.c
+new file mode 100644
+index 0000000..13e0213
+--- /dev/null
++++ b/driver/lock-Gtk.c
[email protected]@ -0,0 +1,968 @@
++/* lock-Gtk.c -- a GTK+ password dialog for xscreensaver
++ * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <[email protected]>
++ *
++ * Permission to use, copy, modify, distribute, and sell this software and its
++ * documentation for any purpose is hereby granted without fee, provided that
++ * the above copyright notice appear in all copies and that both that
++ * copyright notice and this permission notice appear in supporting
++ * documentation.  No representations are made about the suitability of this
++ * software for any purpose.  It is provided "as is" without express or
++ * implied warranty.
++ */
++
++/* GTK+ locking code written by Jacob Berkman  <[email protected]> for
++ *  Sun Microsystems.
++ *
++ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice (including the next
++ * paragraph) shall be included in all copies or substantial portions of the
++ * Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++ * DEALINGS IN THE SOFTWARE.
++ */
++
++#ifdef HAVE_CONFIG_H
++# include "config.h"
++#endif
++
++#ifdef HAVE_GTK2 /* whole file */
++
++#include <xscreensaver-intl.h>
++
++#include <unistd.h>
++#include <errno.h>
++#include <string.h>
++#include <time.h>
++#include <stdlib.h>
++#include <stdio.h>
++#include <fcntl.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++
++#include <gtk/gtk.h>
++#include <gdk/gdkx.h>
++
++/* AT-enabled */
++#include <stdio.h>
++#include <ctype.h>
++#include <X11/Xos.h>
++#include <X11/Xlib.h>
++#include <X11/Xatom.h>
++#include <X11/Xutil.h>
++#include <X11/Xmu/WinUtil.h>
++
++#include <gconf/gconf-client.h>
++#ifdef HAVE_LOGINHELPER
++#include <libbonobo.h>
++#include <login-helper/Accessibility_LoginHelper.h>
++#endif
++#include <atk/atkobject.h>
++
++#include "remote.h"
++#include "atoms.h"
++
++#if GTK_CHECK_VERSION(2,14,0)
++# define GET_WINDOW(w)          gtk_widget_get_window (w)
++#else
++# define GET_WINDOW(w)          ((w)->window)
++#endif
++
++static Atom XA_UNLOCK_RATIO;
++
++typedef struct {
++  GtkWidget *dialog;
++  GtkWidget *user_prompt_label;
++  GtkWidget *user_input_entry;
++  GtkWidget *progress;
++  GtkWidget *button;
++  GtkWidget *msg_label;
++  GtkWidget *pam_message_label;
++} PasswdDialog;
++
++/*Global info */
++#define MAXRAISEDWINS  2
++
++char *progname = 0;
++FILE *parent_file = NULL; /* child writes to parent on this */
++
++#define FD_TO_PARENT  9
++
++/* Send a command to the xscreensaver parent daemon
++   Arguments:
++    - msg - type of message - "input", "raise_wid", etc.
++    - data - data for message
++    - flush - whether to flush now or allow stdio to buffer
++   Message format sent to parent:
++    "msg\n" if no data, otherwise "msg=data\n"
++
++   Can be used to flush previously buffered messages by calling
++   with NULL msg & data, and TRUE for flush.
++ */
++static int
++write_to_parent (const char* msg, const char *data, gboolean flush)
++{
++  int len = 0;
++
++  /*
++  fprintf (stderr, "-->Child write_to_parent() string to send is: %s=%s\n",
++           msg, data ? data : "(null)");
++  fflush (stderr);
++  */
++
++  if (msg)
++    {
++      if (data)
++        len = fprintf (parent_file, "%s=%s\n", msg, data);
++      else
++        len = fprintf (parent_file, "%s\n", msg);
++    }
++
++  if (flush)
++    fflush (parent_file);
++
++  return len;
++}
++
++/* Send parent a message with a window id as the data */
++static void
++write_windowid (const char* msg, Window w)
++{
++  char s[16]; /* more than long enough to hold a 32-bit integer + '\0' */
++
++  snprintf(s, sizeof(s), "0x%lx", w);
++  write_to_parent(msg, s, FALSE);
++}
++
++static GtkWidget *
++load_unlock_logo_image (void)
++{
++  const char *logofile;
++  struct stat statbuf;
++
++  logofile = DEFAULT_ICONDIR "/unlock-logo.png";
++
++  if (stat (logofile, &statbuf) != 0)
++    {
++      logofile = DEFAULT_ICONDIR "/logo-180.gif"; /* fallback */
++    }
++
++  return gtk_image_new_from_file (logofile);
++}
++
++/* Create unlock dialog */
++static PasswdDialog *
++make_dialog (gboolean center_pos)
++{
++  GtkWidget *dialog;
++  AtkObject *atk_dialog;
++  GtkWidget *frame1, *frame2;
++  GtkWidget *vbox;
++  GtkWidget *hbox1, *hbox2;
++  GtkWidget *bbox;
++  GtkWidget *vbox2;
++  GtkWidget *entry;
++  AtkObject *atk_entry;
++  GtkWidget *title_label, *msg_label, *prompt_label,
++    *user_label, *date_label, *pam_msg_label;
++  AtkObject *atk_title_label, *atk_prompt_label;
++  GtkWidget *button;
++  GtkWidget *image;
++  GtkWidget *progress;
++  char *version;
++  char *user;
++  char *host;
++  char *s;
++  gchar *format_string_locale, *format_string_utf8;
++  PasswdDialog *pwd;
++
++  /* taken from lock.c */
++  char buf[256];
++  gchar *utf8_format;
++  time_t now = time (NULL);
++  struct tm* tm;
++
++  server_xscreensaver_version (GDK_DISPLAY (), &version, &user, &host);
++
++  if (!version)
++    {
++      fprintf (stderr, "%s: no xscreensaver running on display %s, exiting.\n",
++               progname, gdk_get_display ());
++      exit (1);
++    }
++
++  /* PUSH */
++  gtk_widget_push_colormap (gdk_rgb_get_cmap ());
++
++  pwd = g_new0 (PasswdDialog, 1);
++
++  dialog = gtk_window_new (GTK_WINDOW_POPUP);
++  pwd->dialog = dialog;
++
++  /*
++  ** bugid: 5077989(P2)Bug 147580: password input dialogue obscures GOK
++     gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
++     bugid: 5002244:  scr unlock dialog incompatible with MAG technique
++  ** 6182506: scr dialog is obscured by MAG window
++  */
++  if (center_pos)
++    gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
++  else
++    gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
++
++  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); /*mali99 irritating*/
++
++  /* AT-enabled dialog role = frame */
++  atk_dialog = gtk_widget_get_accessible (dialog);
++  atk_object_set_description (atk_dialog, _("screen unlock dialog"));
++
++  /* frame */
++  frame1 = g_object_new (GTK_TYPE_FRAME,
++                         "shadow-type", GTK_SHADOW_OUT,
++                         NULL);
++  gtk_container_add (GTK_CONTAINER (dialog), frame1);
++  /* AT role = panel */
++
++  /* vbox */
++  vbox = gtk_vbox_new (FALSE, 10);
++  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
++  gtk_container_add (GTK_CONTAINER (frame1), vbox);
++  /* AT role= filler(default) */
++
++  /* hbox */
++  hbox1 = gtk_hbox_new (FALSE, 5);
++  gtk_box_pack_start (GTK_BOX (vbox), hbox1,
++                      TRUE, TRUE, 0);
++
++  /* image frame */
++  frame2 = g_object_new (GTK_TYPE_FRAME,
++                         "shadow-type", GTK_SHADOW_ETCHED_IN,
++                         NULL);
++  gtk_box_pack_start (GTK_BOX (hbox1), frame2,
++                      TRUE, TRUE, 0);
++  /* AT role= filler(default) */
++
++  /* image */
++  image = load_unlock_logo_image ();
++  /* AT role = icon */
++  gtk_container_add (GTK_CONTAINER (frame2), image);
++
++  /* progress thingie */
++  progress = g_object_new (GTK_TYPE_PROGRESS_BAR,
++                           "orientation", GTK_PROGRESS_BOTTOM_TO_TOP,
++                           "fraction", 1.0,
++                           NULL);
++  gtk_box_pack_start (GTK_BOX (hbox1), progress,
++                      FALSE, FALSE, 0);
++  pwd->progress = progress;
++  atk_object_set_description (gtk_widget_get_accessible (progress),
++            _("Percent of time you have left to unlock the screen."));
++
++  /* text fields */
++  vbox2 = gtk_vbox_new (FALSE, 20);
++  gtk_box_pack_start (GTK_BOX (hbox1), vbox2,
++                      TRUE, TRUE, 0);
++  /* AT role =filler */
++
++  s = g_markup_printf_escaped ("<span size=\"xx-large\"><b>%s </b></span>",
++                               _("Screensaver"));
++  /* XScreenSaver foo label */
++  title_label = g_object_new (GTK_TYPE_LABEL,
++                              "use-markup", TRUE,
++                              "label", s,
++                              NULL);
++  g_free (s);
++  gtk_box_pack_start (GTK_BOX (vbox2), title_label,
++                      FALSE, FALSE, 0);
++  /* AT role = label prog name */
++  atk_title_label = gtk_widget_get_accessible (title_label);
++  atk_object_add_relationship (atk_title_label, ATK_RELATION_LABEL_FOR,
++                               atk_dialog);
++  atk_object_add_relationship (atk_dialog, ATK_RELATION_LABELLED_BY,
++                               atk_title_label);
++
++  /* This display is locked. */
++  msg_label = g_object_new (GTK_TYPE_LABEL,
++                            "use-markup", TRUE,
++                            "label", _("<b>This display is locked.</b>"),
++                            NULL);
++  pwd->msg_label = msg_label;
++  gtk_box_pack_start (GTK_BOX (vbox2), msg_label,
++                      FALSE, FALSE, 0);
++
++  /* User information */
++  s = g_strdup_printf (_("User: %s"), user ? user : "");
++  user_label = g_object_new (GTK_TYPE_LABEL,
++                             "label", s,
++                             "use_underline", TRUE,
++                             NULL);
++  g_free(s);
++  gtk_label_set_width_chars (GTK_LABEL (user_label), 35);
++  gtk_box_pack_start (GTK_BOX (vbox2), user_label, FALSE, FALSE, 0);
++
++  /* User input */
++  hbox2 = gtk_widget_new (GTK_TYPE_HBOX,
++                          "border_width", 5,
++                          "visible", TRUE,
++                          "homogeneous", FALSE,
++                          "spacing", 1,
++                          NULL);
++
++  /* PAM prompt */
++  prompt_label = g_object_new (GTK_TYPE_LABEL,
++                               /* blank space for prompt */
++                               "label", _("         "),
++                               "use_underline", TRUE,
++                               "use_markup", FALSE,
++                               "justify", GTK_JUSTIFY_CENTER,
++                               "wrap", FALSE,
++                               "selectable", FALSE,
++                               "xalign", 1.0,
++                               "xpad", 0,
++                               "ypad", 0,
++                               "visible", FALSE,
++                               NULL);
++  pwd->user_prompt_label = prompt_label;
++
++  entry = g_object_new (GTK_TYPE_ENTRY,
++                        "activates-default", TRUE,
++                        "visible", TRUE,
++                        "editable", TRUE,
++                        "visibility", FALSE,
++                        "can_focus", TRUE,
++                        NULL);
++  pwd->user_input_entry = entry;
++  /* gtk_widget_grab_focus (entry); */
++  atk_entry = gtk_widget_get_accessible (entry);
++  atk_object_set_role (atk_entry, ATK_ROLE_PASSWORD_TEXT);
++
++  /* AT role = label for input widget */
++  atk_prompt_label = gtk_widget_get_accessible (prompt_label);
++  atk_object_add_relationship (atk_prompt_label, ATK_RELATION_LABEL_FOR,
++                               atk_entry);
++  atk_object_add_relationship (atk_entry, ATK_RELATION_LABELLED_BY,
++                               atk_prompt_label);
++
++  gtk_box_pack_start (GTK_BOX (hbox2), prompt_label, FALSE, FALSE, 0);
++  gtk_box_pack_end (GTK_BOX (hbox2), entry, TRUE, TRUE, 0);
++  gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
++
++  pam_msg_label = g_object_new (GTK_TYPE_LABEL,
++                                NULL);
++  pwd->pam_message_label = pam_msg_label;
++
++  gtk_box_pack_start (GTK_BOX (vbox2), pam_msg_label, FALSE, FALSE, 0);
++
++  /* date string */
++  tm = localtime (&now);
++  memset (buf, 0, sizeof (buf));
++  format_string_utf8 = _("%d-%b-%y (%a); %I:%M %p");
++  format_string_locale = g_locale_from_utf8 (format_string_utf8, -1,
++                                             NULL, NULL, NULL);
++  strftime (buf, sizeof (buf) - 1, format_string_locale, tm);
++  g_free (format_string_locale);
++
++  utf8_format = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
++  s = g_markup_printf_escaped ("<small>%s</small>", utf8_format);
++  g_free (utf8_format);
++
++  date_label = g_object_new (GTK_TYPE_LABEL,
++                             "use-markup", TRUE,
++                             "label", s,
++                             NULL);
++  g_free (s);
++  gtk_box_pack_start (GTK_BOX (vbox2), date_label,
++                      FALSE, FALSE, 0);
++
++  /* button box */
++  bbox = g_object_new (GTK_TYPE_HBUTTON_BOX,
++                       "layout-style", GTK_BUTTONBOX_END,
++                       "spacing", 10,
++                       NULL);
++
++  /* Ok button */
++  button = gtk_button_new_from_stock (GTK_STOCK_OK);
++  pwd->button = button;
++
++  gtk_box_pack_end (GTK_BOX (bbox), button,
++                    FALSE, TRUE, 0);
++
++  free (user);
++  free (version);
++  free (host);
++
++  /* POP */
++  gtk_widget_pop_colormap ();
++
++  return pwd;
++}
++
++/* Callback for when user has finished entering input, even though
++   we don't display an "OK" button for them to click on */
++static void
++ok_clicked_cb (GtkWidget *button, PasswdDialog *pwd)
++{
++  const char *s;
++
++  g_object_set (pwd->msg_label, "label", _("<b>Checking...</b>"), NULL);
++
++  s = gtk_entry_get_text (GTK_ENTRY (pwd->user_input_entry));
++  write_to_parent ("input", s, TRUE);
++
++  /* Reset password field to blank, else passwd field shows old passwd *'s,
++     visible when passwd is expired, and pam is walking the user to change
++     old passwd.
++   */
++  gtk_editable_delete_text (GTK_EDITABLE (pwd->user_input_entry), 0, -1);
++  gtk_widget_hide (pwd->user_input_entry);
++  gtk_widget_hide (pwd->user_prompt_label);
++}
++
++static void
++connect_signals (PasswdDialog *pwd)
++{
++  g_signal_connect (pwd->button, "clicked",
++                    G_CALLBACK (ok_clicked_cb),
++                    pwd);
++
++  g_signal_connect (pwd->user_input_entry, "activate",
++                    G_CALLBACK (ok_clicked_cb),
++                    pwd);
++
++  g_signal_connect (pwd->dialog, "delete-event",
++                    G_CALLBACK (gtk_main_quit),
++                    NULL);
++}
++
++static GdkFilterReturn
++dialog_filter_func (GdkXEvent *xevent, GdkEvent *gevent, gpointer data)
++{
++  PasswdDialog *pwd = data;
++  XEvent *event = xevent;
++  gdouble ratio;
++
++  if ((event->xany.type != ClientMessage ||
++       event->xclient.message_type != XA_UNLOCK_RATIO))
++    return GDK_FILTER_CONTINUE;
++
++  ratio = event->xclient.data.l[0] / (gdouble)100.0;
++
++  /* CR 6176524 passwdTimeoutEnable for disabled user */
++  if (event->xclient.data.l[1] == 0)
++    g_object_set (pwd->progress, "fraction", ratio, NULL);
++
++  return GDK_FILTER_REMOVE;
++}
++
++static gboolean
++handle_input (GIOChannel *source, GIOCondition cond, gpointer data)
++{
++  PasswdDialog *pwd = data;
++  GIOStatus status;
++  char *str;
++  char *label;
++  char *hmsg = NULL;  /* This is the heading of lock dialog..shows status */
++
++  if (cond & G_IO_HUP) /* daemon crashed/exited/was killed */
++    gtk_main_quit ();
++
++  do
++    {
++      status = g_io_channel_read_line (source, &str, NULL, NULL, NULL);
++    }
++  while (status == G_IO_STATUS_AGAIN);
++
++/* debug only
++  if (status == G_IO_STATUS_ERROR)
++      g_message ("handle input() status_error %s\n",str);
++  if (status == G_IO_STATUS_EOF)
++      g_message ("handle input() status_eof %s\n",str);
++  if (status == G_IO_STATUS_NORMAL)
++      g_message ("handle input() status_normal %s\n",str);
++  Most likely, the returned error msg of g_io_channel_read_line(),
++  i.e str will not be translated into other locales ...
++*/
++
++  if (str)
++    {
++      /* strip trailing newline */
++      char *nl = strrchr(str, '\n');
++      if (nl)
++        *nl = 0;
++
++      /*
++      fprintf (stderr,">>>>>Child..in handle_input..string is:%s\n",str);
++      fflush (stderr);
++      */
++
++      /* Handle commands from parent daemon */
++
++      if (((strncmp (str, "ul_", 3)) == 0))
++        {
++          /* search for =, and if found, split into two strings there */
++          char *msgstr = strchr(str, '='); /* Data sent with command */
++          if (msgstr)
++            *msgstr++ = 0;
++
++          if ((strcmp (str, "ul_ok") == 0))
++            {
++              hmsg = _("Authentication Successful!");
++            }
++          else if ((strcmp (str, "ul_acct_ok") == 0))
++            {
++              hmsg = _("PAM Account Management Also Successful!");
++            }
++          else if ((strcmp (str, "ul_setcred_fail") == 0))
++            {
++              hmsg = _("Just a Warning PAM Set Credential Failed!");
++            }
++          else if ((strcmp (str, "ul_setcred_ok") == 0))
++            {
++              hmsg = _("PAM Set Credential Also Successful!");
++            }
++          else if ((strcmp (str, "ul_acct_fail") == 0))
++            {
++              hmsg = _("Your Password has expired.");
++            }
++          else if ((strcmp (str, "ul_fail") == 0))
++            {
++              hmsg = _("Sorry!");
++            }
++          else if ((strcmp (str, "ul_read") == 0))
++            {
++              hmsg = _("Waiting for user input!");
++            }
++          else if ((strcmp (str, "ul_time") == 0))
++            {
++              hmsg = _("Timed Out!");
++            }
++          else if ((strcmp (str, "ul_null") == 0))
++            {
++              hmsg = _("Still Checking!");
++            }
++          else if ((strcmp (str, "ul_cancel") == 0))
++            {
++              hmsg = _("Authentication Cancelled!");
++            }
++          else if ((strcmp (str, "ul_pamprompt") == 0))
++            {
++              gtk_label_set_text (GTK_LABEL (pwd->user_prompt_label), msgstr);
++              gtk_widget_show (pwd->user_prompt_label);
++              msgstr = NULL; /* clear message so we don't show it twice */
++            }
++          else if ((strcmp (str, "ul_prompt_echo") == 0))
++            {
++              if ((strcmp (msgstr, "true") == 0))
++                {
++                  gtk_entry_set_visibility
++                    (GTK_ENTRY (pwd->user_input_entry), TRUE);
++                }
++              else
++                {
++                  if ((strcmp (msgstr, "stars") == 0))
++                    /* reset to default display of "*" or bullet */
++                    gtk_entry_unset_invisible_char
++                      (GTK_ENTRY (pwd->user_input_entry));
++                  else
++                    /* set to no display */
++                    gtk_entry_set_invisible_char
++                       (GTK_ENTRY (pwd->user_input_entry), 0);
++
++                  gtk_entry_set_visibility
++                    (GTK_ENTRY (pwd->user_input_entry), FALSE);
++                }
++              msgstr = NULL; /* clear message so we don't show it to user */
++              /* Show the entry field */
++              gtk_widget_show (pwd->user_input_entry);
++              gtk_widget_grab_focus (pwd->user_input_entry);
++              gdk_display_sync
++		  (gtk_widget_get_display (pwd->user_input_entry));
++            }
++          else if ((strcmp (str, "ul_message") == 0))
++            {
++              hmsg = NULL; /* only show msg */
++            }
++          else
++            {
++              /* Should not be others, but if so just show it */
++              hmsg = str;
++            }
++
++          if (hmsg)
++            {
++              label = g_markup_printf_escaped ("<b>%s</b>", hmsg);
++              g_object_set (pwd->msg_label, "label", label, NULL);
++              g_free (label);
++            }
++
++          if (msgstr)
++            {
++              gtk_label_set_text (GTK_LABEL (pwd->pam_message_label), msgstr);
++            }
++        }
++      else if ((strcmp (str, "cmd_exit") == 0))
++        {
++          gtk_main_quit ();
++        }
++      else /* something came through that didn't start with ul_ */
++        {
++          gtk_label_set_text (GTK_LABEL (pwd->pam_message_label), str);
++        }
++
++      g_free (str);
++    }
++
++  return (status != G_IO_STATUS_EOF);
++}
++
++int
++main (int argc, char *argv[])
++{
++  GIOChannel *ioc;
++  PasswdDialog *pwd;
++  char *s;
++  char *real_progname = argv[0];
++  GConfClient *client;
++  const char *modulesptr = NULL;
++  int i;
++  const char *locale = NULL;
++
++  gboolean  at_enable  = FALSE; /* accessibility mode enabled ? */
++#ifdef HAVE_LOGINHELPER
++  Bonobo_ServerInfoList *server_list = NULL;
++  CORBA_Environment ev;
++  Accessibility_LoginHelper helper;
++  Accessibility_LoginHelper *helper_list = NULL;
++  CORBA_boolean safe;
++#endif
++  gboolean center_position = TRUE; /* center dialog on screen? */
++
++#ifdef ENABLE_NLS
++  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
++  textdomain (GETTEXT_PACKAGE);
++
++#ifdef HAVE_GTK2
++  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
++#else /* ! HAVE_GTK2 */
++  if (!setlocale (LC_ALL, ""))
++    fprintf (stderr, "%s: locale not supported by C library\n", real_progname);
++#endif /* ! HAVE_GTK2 */
++#endif /* ENABLE_NLS */
++
++  s = strrchr (real_progname, '/');
++  if (s) real_progname = s+1;
++  progname = real_progname;
++
++  parent_file = fdopen(FD_TO_PARENT, "w");
++  if (!parent_file)
++    {
++      fprintf (stderr, "%s: can't communicate with parent, exiting.\n",
++               progname);
++      exit (1);
++    }
++
++  gtk_init (&argc, &argv);
++
++  /* Intern the atoms that xscreensaver_command() needs.
++   */
++  {
++    Display *dpy = gdk_x11_get_default_xdisplay();
++
++    const struct atom_request unlock_atoms[] =
++      {
++	{ &XA_UNLOCK_RATIO, "UNLOCK_RATIO" },
++	{ NULL, NULL } /* Must be last to terminate list */
++      };
++
++    const struct atom_request *atom_lists[3] = { NULL, NULL, NULL };
++    atom_lists[0] = remote_control_atoms;
++    atom_lists[1] = unlock_atoms;
++    request_atoms (dpy, atom_lists);
++  }
++
++  /* bugid 6346056(P1):
++     ATOK pallet sometimes appears in screensave/lock-screen mode
++  */
++  putenv ("GTK_IM_MODULE=gtk-im-context-simple");
++
++
++  /* accessibility mode enabled ? */
++  client = gconf_client_get_default ();
++  at_enable = gconf_client_get_bool (client,
++                                     "/desktop/gnome/interface/accessibility",
++                                     NULL);
++  if (at_enable)
++    {
++
++      /* GTK Accessibility Module initialized */
++      modulesptr = g_getenv ("GTK_MODULES");
++      if (!modulesptr || modulesptr [0] == '\0')
++        putenv ("GTK_MODULES=gail:atk-bridge");
++
++#ifdef HAVE_LOGINHELPER
++      CORBA_exception_init (&ev);
++      if (!bonobo_init (&argc, argv))
++        {
++          g_error ("Can't initialize Bonobo");
++        }
++
++      /* bonobo-activation query lists existing instances */
++      server_list = bonobo_activation_query (
++        "(repo_ids.has('IDL:Accessibility/LoginHelper:1.0')) AND _active",
++        NULL, &ev);
++
++      if (BONOBO_EX (&ev))
++        {
++          bonobo_debug_shutdown ();
++          g_error ("LoginHelper query failed : %s",
++                   bonobo_exception_get_text (&ev));
++          /* not reached (below) because g_error exits */
++          CORBA_exception_free (&ev);
++        }
++
++      /*
++       * 6182506: unlock dialog can be obscured by the magnifier window
++       * if it's always centered, so don't force that if any accessibility
++       * helpers are present
++       */
++      if (server_list && server_list->_length)
++        center_position = FALSE;
++#endif
++    } /* accessibility enabled */
++
++  pwd = make_dialog (center_position);
++  connect_signals (pwd);
++
++  gtk_widget_show_all (pwd->dialog);
++  gtk_window_present (GTK_WINDOW (pwd->dialog));
++  gtk_widget_map (pwd->dialog);
++
++  gdk_display_sync (gtk_widget_get_display (pwd->dialog));
++
++  gdk_window_add_filter (GET_WINDOW (pwd->dialog), dialog_filter_func, pwd);
++  write_windowid ("dialog_win", GDK_WINDOW_XID (GET_WINDOW (pwd->dialog)));
++
++#ifdef HAVE_LOGINHELPER
++  if (server_list && server_list->_length)
++    {
++      /* debug only
++      g_message ("%d LoginHelpers are running.",
++                 server_list ? server_list->_length : 0);
++      */
++
++      helper_list = g_new0 (Accessibility_LoginHelper, server_list->_length);
++
++      /* for each instance... */
++      for (i = 0; i < server_list->_length; i++)
++        {
++          Bonobo_Unknown server;
++          Bonobo_ServerInfo info = server_list->_buffer[i];
++
++          server = bonobo_activation_activate_from_id (
++              info.iid, Bonobo_ACTIVATION_FLAG_EXISTING_ONLY, NULL, &ev);
++
++          if (BONOBO_EX (&ev))
++            {
++              g_warning ("Error activating server %d: %s", i,
++                         bonobo_exception_get_text (&ev));
++              CORBA_exception_free (&ev);
++              continue;
++            }
++          else if (server == CORBA_OBJECT_NIL)
++            {
++              g_warning ("Activated server %d is NIL!", i);
++              continue;
++            }
++
++          bonobo_activate ();
++
++          helper = Bonobo_Unknown_queryInterface
++            (server, "IDL:Accessibility/LoginHelper:1.0", &ev);
++
++          if (BONOBO_EX (&ev))
++            {
++              g_warning ("Error performing interface query: %s",
++                         bonobo_exception_get_text (&ev));
++              CORBA_exception_free (&ev);
++              continue;
++            }
++          else if (helper == CORBA_OBJECT_NIL)
++            {
++              g_warning ("Activated an object which advertised LoginHelper but does not implement it!");
++              continue;
++            }
++
++          helper_list[i] = helper;
++          bonobo_object_release_unref (server, &ev);
++
++          if (helper && !BONOBO_EX (&ev))
++            {
++              /* ask the helper to go into safe mode */
++              safe = Accessibility_LoginHelper_setSafe (helper, TRUE, &ev);
++              if (BONOBO_EX (&ev))
++                {
++                  g_warning ("setSafe(TRUE) failed: %s",
++                             bonobo_exception_get_text (&ev));
++                  CORBA_exception_free (&ev);
++                }
++
++              /* get the raise window list (if the program went into safe mode) */
++              if (safe)
++                {
++                  int j;
++                  gboolean needs_windows_raised = FALSE;
++                  Accessibility_LoginHelper_DeviceReqList *list;
++
++                  g_debug ("safe");
++
++                  /* does this helper need to have windows raised? */
++                  list = Accessibility_LoginHelper_getDeviceReqs (helper, &ev);
++
++                  if (BONOBO_EX (&ev))
++                    {
++                      g_warning ("Bonobo exception getting Device Requirements: %s",
++                                 bonobo_exception_get_text (&ev));
++                      CORBA_exception_free (&ev);
++                    }
++                  else
++                    {
++                      g_debug ("LoginHelper device requirements: ");
++                      if (list->_length == 0)
++                        g_debug (" - None.");
++
++                      for (j = 0; j < list->_length; j++)
++                        {
++                          switch (list->_buffer[j])
++                            {
++                            case Accessibility_LoginHelper_GUI_EVENTS:
++                              g_debug (" - Needs access to the GUI event subsystem (e.g. Xserver)");
++                              break;
++                            case Accessibility_LoginHelper_CORE_KEYBOARD:
++                              g_debug (" - Needs access to core keyboard device");
++                              write_to_parent("ungrab_keyboard", "true", FALSE);
++                              break;
++                            case Accessibility_LoginHelper_CORE_POINTER:
++                              g_debug (" - Needs access to core pointer device");
++                              write_to_parent("ungrab_pointer", "true", FALSE);
++                              break;
++                            case Accessibility_LoginHelper_EXT_INPUT:
++                              g_debug (" - Reads XInput extended input devices");
++                              break;
++                            case Accessibility_LoginHelper_POST_WINDOWS:
++                              g_debug (" - Posts windows");
++                              needs_windows_raised = TRUE;
++                              break;
++                            case Accessibility_LoginHelper_AUDIO_OUT:
++                              g_debug (" - Writes to audio device");
++                              break;
++                            case Accessibility_LoginHelper_AUDIO_IN:
++                              g_debug (" - Reads from audio device");
++                              break;
++                            case Accessibility_LoginHelper_LOCALHOST:
++                              g_debug (" - Needs LOCALHOST network connection");
++                              break;
++                            case Accessibility_LoginHelper_SERIAL_OUT:
++                              g_debug (" - Needs to write to one or more serial ports");
++                              break;
++                            default:
++                              break;
++                            }
++                        }
++                      CORBA_free (list);
++                    }
++
++                  if (needs_windows_raised)
++                    {
++                      Accessibility_LoginHelper_WindowList *windows
++                        = Accessibility_LoginHelper_getRaiseWindows
++                        (helper, &ev);
++
++                      if (BONOBO_EX (&ev))
++                        {
++                          g_warning ("getRaiseWindows failed: %s",
++                                     bonobo_exception_get_text (&ev));
++                          CORBA_exception_free (&ev);
++                        }
++
++                      g_debug ("%d windows need raising", windows->_length);
++                      for (j = 0; j < windows->_length; j++)
++                        {
++                          Window wid = windows->_buffer[j].winID;
++                          g_debug ("Window ID = 0x%lx", wid);
++                          if (wid)
++                            write_windowid ("raise_win", wid);
++                        }
++                    }
++                }
++              else
++                {
++                  g_warning ("LoginHelper %d did not go into safe mode", i);
++                }
++            }
++           else
++            {
++              if (BONOBO_EX (&ev))
++                {
++                  g_warning ("Error activating %s: %s",
++                             info.iid, bonobo_exception_get_text (&ev));
++                  CORBA_exception_free (&ev);
++                }
++              else
++                {
++                  g_warning ("no active instance of %s found", info.iid);
++                }
++            }
++        }
++    } /* accessibility helpers active */
++#endif
++
++  /* Flush dialog window ids & any messages about login helpers to parent */
++  write_to_parent(NULL, NULL, TRUE);
++
++  gtk_widget_grab_focus (pwd->user_input_entry);
++
++  ioc = g_io_channel_unix_new (0);
++  g_get_charset (&locale);
++  g_io_channel_set_encoding(ioc, locale, NULL);
++  g_io_add_watch (ioc, G_IO_IN | G_IO_HUP, handle_input, pwd);
++
++  gtk_main ();
++
++#ifdef LOGIN_HELPER
++  /* Reset accessibility helpers back to non-safe mode now that we're done */
++  if (server_list)
++    {
++      for (i = 0; i < server_list->_length; i++)
++        {
++          helper = helper_list[i];
++          /* really no need to check the return value this time */
++          Accessibility_LoginHelper_setSafe (helper, FALSE, &ev);
++          if (BONOBO_EX (&ev))
++            {
++              g_warning ("setSafe(FALSE) failed: %s",
++                         bonobo_exception_get_text (&ev));
++              CORBA_exception_free (&ev);
++            }
++          CORBA_Object_release (helper, &ev);
++        }
++      CORBA_free (server_list);
++      bonobo_debug_shutdown ();
++    }
++#endif
++
++  return 0;
++}
++#endif /* HAVE_GTK2 */
+diff --git a/driver/lock.c b/driver/lock.c
+index 7c92be6..becf85b 100644
+--- a/driver/lock.c
++++ b/driver/lock.c
[email protected]@ -21,8 +21,13 @@
+ #include <X11/Intrinsic.h>
+ #include <X11/cursorfont.h>
+ #include <X11/Xos.h>		/* for time() */
++#include <X11/Xatom.h>
+ #include <time.h>
+ #include <sys/time.h>
++#include <errno.h>
++#include <gconf/gconf-client.h>
++#include "exec.h"
++#include "dialog-data.h"
+ #include "xscreensaver.h"
+ #include "resources.h"
+ #include "mlstring.h"
[email protected]@ -83,126 +88,631 @@ vms_passwd_valid_p(char *pw, Bool verbose_p)
+ 
+ typedef struct info_dialog_data info_dialog_data;
+ 
++/* struct passwd_dialog_data moved to dialog-data.h */
+ 
+-#define MAX_BYTES_PER_CHAR 8	/* UTF-8 uses no more than 3, I think */
+-#define MAX_PASSWD_CHARS   128	/* Longest possible passphrase */
+-
+-struct passwd_dialog_data {
+-
+-  saver_screen_info *prompt_screen;
+-  int previous_mouse_x, previous_mouse_y;
+-
+-  /* "Characters" in the password may be a variable number of bytes long.
+-     typed_passwd contains the raw bytes.
+-     typed_passwd_char_size indicates the size in bytes of each character,
+-     so that we can make backspace work.
+-   */
+-  char typed_passwd [MAX_PASSWD_CHARS * MAX_BYTES_PER_CHAR];
+-  char typed_passwd_char_size [MAX_PASSWD_CHARS];
+-  
+-  XtIntervalId timer;
+-  int i_beam;
+-
+-  float ratio;
+-  Position x, y;
+-  Dimension width;
+-  Dimension height;
+-  Dimension border_width;
+-
+-  Bool echo_input;
+-  Bool show_stars_p; /* "I regret that I have but one asterisk for my country."
+-                        -- Nathan Hale, 1776. */
+-
+-  char *heading_label;
+-  char *body_label;
+-  char *user_label;
+-  mlstring *info_label;
+-  /* The entry field shall only be displayed if prompt_label is not NULL */
+-  mlstring *prompt_label;
+-  char *date_label;
+-  char *passwd_string;
+-  Bool passwd_changed_p; /* Whether the user entry field needs redrawing */
+-  Bool caps_p;		 /* Whether we saw a keypress with caps-lock on */
+-  char *unlock_label;
+-  char *login_label;
+-  char *uname_label;
+-
+-  Bool show_uname_p;
+-
+-  XFontStruct *heading_font;
+-  XFontStruct *body_font;
+-  XFontStruct *label_font;
+-  XFontStruct *passwd_font;
+-  XFontStruct *date_font;
+-  XFontStruct *button_font;
+-  XFontStruct *uname_font;
+-
+-  Pixel foreground;
+-  Pixel background;
+-  Pixel border;
+-  Pixel passwd_foreground;
+-  Pixel passwd_background;
+-  Pixel thermo_foreground;
+-  Pixel thermo_background;
+-  Pixel shadow_top;
+-  Pixel shadow_bottom;
+-  Pixel button_foreground;
+-  Pixel button_background;
+-
+-  Dimension preferred_logo_width, logo_width;
+-  Dimension preferred_logo_height, logo_height;
+-  Dimension thermo_width;
+-  Dimension internal_border;
+-  Dimension shadow_width;
+-
+-  Dimension passwd_field_x, passwd_field_y;
+-  Dimension passwd_field_width, passwd_field_height;
+-
+-  Dimension unlock_button_x, unlock_button_y;
+-  Dimension unlock_button_width, unlock_button_height;
+-
+-  Dimension login_button_x, login_button_y;
+-  Dimension login_button_width, login_button_height;
+-
+-  Dimension thermo_field_x, thermo_field_y;
+-  Dimension thermo_field_height;
+-
+-  Pixmap logo_pixmap;
+-  Pixmap logo_clipmask;
+-  int logo_npixels;
+-  unsigned long *logo_pixels;
+-
+-  Cursor passwd_cursor;
+-  Bool unlock_button_down_p;
+-  Bool login_button_down_p;
+-  Bool login_button_p;
+-  Bool login_button_enabled_p;
+-  Bool button_state_changed_p; /* Refers to both buttons */
+-
+-  Pixmap save_under;
+-  Pixmap user_entry_pixmap;
+-};
+-
++#ifndef HAVE_XSCREENSAVER_LOCK
+ static void draw_passwd_window (saver_info *si);
++#endif
+ static void update_passwd_window (saver_info *si, const char *printed_passwd,
+ 				  float ratio);
+ static void destroy_passwd_window (saver_info *si);
++static int ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error);
+ static void undo_vp_motion (saver_info *si);
++#ifndef HAVE_XSCREENSAVER_LOCK
+ static void finished_typing_passwd (saver_info *si, passwd_dialog_data *pw);
++#endif
+ static void cleanup_passwd_window (saver_info *si);
+ static void restore_background (saver_info *si);
+ 
+ extern void xss_authenticate(saver_info *si, Bool verbose_p);
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++
++#define WIN_ALLOC_INCREMENT 8	/* allocate entries in the window lists in
++                                   increments of 8 at a time for fewer
++                                   reallocs and less chance of malloc error
++                                   at the wrong time */
++#define EXTRA_RAISE_WIN_SLOTS 4 /* Need to leave four extra slots free in
++                                   raise_wins to allow calling XRestackWindows
++                                   when a window pops up without having to
++                                   realloc or copy to a new list.
++                                   These slots would be used by:
++                                   - passwd_dialog
++                                   - stderr_overlay_window
++                                   - xscreensaver virtual root
++                                   - an interloper popup we need to hide
++                                */
++
++extern Atom XA_UNLOCK_RATIO;
++
++Bool g_passwd_dialog_created = 0;
++
++GConfClient *client = NULL;
++
++static const char *switch_windows_gconf_key
++  = "/apps/metacity/global_keybindings/switch_windows";
++static char  *global_switch_key = NULL;
++
++static const char *main_menu_gconf_key
++  = "/apps/metacity/global_keybindings/panel_main_menu";
++static char  *global_menu_key = NULL;
++
++extern Bool safe_XDestroyWindow (Display *dpy, Window window);
++static Bool safe_XRestackWindows(Display *dpy, Window windows[], int nwindows);
++static Bool safe_XSendEvent(Display *dpy, Window w, Bool propagate,
++                            long event_mask, XEvent *event_send);
++static void passwd_animate_timer (XtPointer closure, XtIntervalId *id);
++extern void swallow_unlock_typeahead_events (saver_info *si, XEvent *e);
++
++
++static saver_screen_info *
++find_screen_for_window (saver_info *si, Window wid)
++{
++  saver_screen_info *ssi;
++  Screen *screen;
++  Window root, root_ret, parent_ret, *children = NULL;
++  unsigned int nchildren = 0;
++  int screen_no, status;
++
++  status = XQueryTree (si->dpy, wid, &root_ret, &parent_ret,
++                       &children, &nchildren);
++
++  if (status == 0) /* failed */
++    return NULL;
++
++  XFree(children);
++  children = NULL;
++
++  for (screen_no = 0; screen_no < si->nscreens; screen_no++)
++    {
++      ssi = &si->screens[screen_no];
++      screen = ssi->screen;
++      root   = RootWindowOfScreen (screen);
++
++      if (root == root_ret)
++        return ssi;
++    }
++
++  return NULL; /* Didn't match the root on any screen  we know of - PUNT! */
++}
++
++/*
++ 5083155 Unable to unlock screen when running dual-head MAG
++ adding dual or multiple heads for magnifier support
++
++ screen 0: loginhelp can pass the raisedWid of GOK or MAG or both
++           found: return its parent Wid (child of root)
++           not found:  0
++
++ other screen:        MAG only if the target screen no > 0 is selected
++           found:  restack on that screen
++               return 0
++           not-found : return 0
++
++ */
++
++static Window
++check_raisedWid (saver_info *si, Window wid)
++{
++  saver_screen_info *ssi;
++  Screen *screen;
++  Window root, root_ret, parent_ret, *children = NULL;
++  unsigned int nchildren = 0;
++  int screen_no, status;
++
++  status = XQueryTree (si->dpy, wid, &root_ret, &parent_ret,
++                       &children, &nchildren);
++
++  if (status == 0) /* failed */
++    return 0;
++
++  XFree(children);
++  children = NULL;
++
++  for (screen_no = 0; screen_no < si->nscreens; screen_no++)
++    {
++      ssi = &si->screens[screen_no];
++      screen = ssi->screen;
++      root   = RootWindowOfScreen (screen);
++
++      if (root == root_ret)
++        break;
++    }
++
++  if ( screen_no >= si->nscreens ) /* Didn't match the root on any screen */
++    return 0;                      /*  we know of - PUNT!                 */
++
++  /* Climb the tree until we find an ancestor that's a child of root */
++  while ( root_ret != parent_ret )
++    {
++      wid = parent_ret;
++
++      status = XQueryTree (si->dpy, wid, &root_ret, &parent_ret,
++                           &children, &nchildren);
++
++      if (status == 0) /* failed */
++        return 0;
++
++      XFree(children);
++      children = NULL;
++    }
++
++  if ( ssi != si->pw_data->prompt_screen )
++    {
++      /* found in other screen (not the one with the unlock dialog),
++         implies MAG target screen, invoke XRestackWindow() there
++      */
++      Window screen_win[2] = { wid, ssi->screensaver_window };
++      safe_XRestackWindows(si->dpy, screen_win, 2);
++      return 0;   /* no need to do the restack on prompt screen */
++    }
++
++  return wid;
++}
++
++/* Enforce window stacking order when a new window arrives.
++   Only allow raising windows the unlock dialog has told us to raise
++   (including itself).
++ */
++static void
++restack_my_windows (saver_info* si, saver_screen_info *ssi, Window newWin)
++{
++  int n = 0;
++  Window short_stack[EXTRA_RAISE_WIN_SLOTS];
++  Window *restack_list;
++  Bool allowed = False;
++
++  /* If window is on another screen than the unlock dialog,
++     or we have list of no windows to raise */
++  if ((si->raise_wins == NULL) || (ssi != si->pw_data->prompt_screen))
++    {
++      restack_list = short_stack;
++    }
++  else
++    {
++      restack_list = si->raise_wins;
++      for (n = 0; n < si->num_raise_wins; n++)
++        {
++          if (si->raise_wins[n] == newWin)
++            allowed = True;
++        }
++    }
++
++  if (si->passwd_dialog && (ssi == si->pw_data->prompt_screen))
++    {
++      restack_list[n++] = si->passwd_dialog;
++      if (si->passwd_dialog == newWin)
++        allowed = True;
++    }
++
++  if (ssi->stderr_overlay_window)
++    {
++      restack_list[n++] = ssi->stderr_overlay_window;
++      if (ssi->stderr_overlay_window == newWin)
++        allowed = True;
++    }
++
++  if (ssi->screensaver_window)
++    {
++      restack_list[n++] = ssi->screensaver_window;
++      if (ssi->screensaver_window == newWin)
++        allowed = True;
++    }
++
++  /* If it's not in the allowed list, it goes behind
++     the screensaver_window. */
++  if (newWin && !allowed)
++    restack_list[n++] = newWin;
++
++  if (n > 1)
++    safe_XRestackWindows (si->dpy, restack_list, n);
++}
++
++/* Send a command to the xscreensaver-lock child process
++   Arguments:
++    - msg - message to send, such as ul_ok
++    - data - additional data, such as string to display for this message,
++             if any, otherwise NULL
++   Message format sent to child:
++    "msg\n" if no data, otherwise "msg=data\n"
++ */
++int
++write_to_child (saver_info* si, const char* msg, const char *data)
++{
++  if (msg == NULL)
++    {
++      fprintf (stderr, "Invalid null message written to child\n");
++      return -1;
++    }
++
++  if (si->external_passwd && g_passwd_dialog_created &&
++      si->pw_data->stdin_fd != -1)
++    {
++      int len;
++
++      if (si->prefs.verbose_p)
++        {
++          fprintf (stderr,
++                   "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
++                   "HAVE_SCRSVR_LOCK writing to fd:%d message is:\n%s=%s\n"
++                   "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n",
++                   si->pw_data->stdin_fd, msg, data ? data : "(null)");
++        }
++
++      if (data)
++        len = fprintf (si->pw_data->stdin_file, "%s=%s\n", msg, data);
++      else
++        len = fprintf (si->pw_data->stdin_file, "%s\n", msg);
++
++      fflush (si->pw_data->stdin_file);
++      return len;
++    }
++
++  return (0); /* if we didn't write anything return 0 */
++}
++
++static int
++sane_dup2 (int fd1, int fd2)
++{
++  int ret;
++
++  do
++    {
++      ret = dup2 (fd1, fd2);
++    }
++  while (ret < 0 && errno == EINTR);
++
++  return ret;
++}
++
++static int
++close_and_invalidate (int *fd)
++{
++  int ret;
++
++  ret = close (*fd);
++  *fd = -1;
++
++  return ret;
++}
++
++void
++handle_passwd_input (XtPointer xtdata, int *fd, XtInputId *id)
++{
++  saver_info *si = (saver_info *)xtdata;
++  saver_preferences *p = &si->prefs;
++  char buffer[1024];
++  char *msg, *data;
++  passwd_dialog_data *pw = si->pw_data;
++
++  if (p->verbose_p)
++    fprintf (stderr, "passwd input handler() fd=%d\n", *fd);
++
++  msg = fgets (buffer, sizeof (buffer), pw->stdout_file);
++  if (!msg)  /* child closed pipe */
++    {
++      if (p->verbose_p)
++        {
++          fprintf (stderr, "done reading...\n");
++          fprintf (stderr, "removing input handler...\n");
++        }
++      XtRemoveInput (*id);
++      pw->stdout_input_id = 0;
++
++      if (p->verbose_p)
++        fprintf (stderr, "passwd input handler() returning...done reading\n");
++
++      return;
++    }
++
++  if (p->verbose_p)
++    fprintf (stderr, "Child sent message: %s\n", msg);
++
++  /* search for =, and if found, split msg & data into two strings there */
++  data = strchr(msg, '=');
++  if (data)
++    {
++      char *nl;
++
++      *data++ = 0;
++
++      /* strip trailing newline */
++      nl = strchr (data, '\n');
++      if (nl)
++        *nl = '\0';
++    }
++  else
++    {
++      /* All the messages we currently expect require data! */
++      if (p->verbose_p)
++        fprintf (stderr, "*** Invalid message: no data found, discarding\n");
++
++      return;
++    }
++
++  if ((strcmp(msg, "input") == 0)) /* User input */
++    {
++      si->unlock_state = ul_finished;
++      pw->got_passwd = TRUE;
++      pw->passwd_string = strdup (data);
++      memset (data, 0, strlen(data));
++    }
++  else if ((strcmp(msg, "ungrab_keyboard") == 0))
++    {
++      /* An accessibility helper needs to access the keyboard, so we have
++         to release our grab - unfortunately this risks other apps acting
++         on keys they shouldn't, so first we disable metacity keys that
++         could allow getting back to the locked session windows, and hope
++         we don't crash or die before restoring them later.
++
++         Other window managers are likely to be risky to use in this case.
++      */
++
++      if (client == NULL)
++        client = gconf_client_get_default();
++
++      if (global_switch_key == NULL)
++        {
++          global_switch_key =
++            gconf_client_get_string (client, switch_windows_gconf_key, NULL);
++
++          if (global_switch_key && strncmp (global_switch_key, "dis", 3))
++            gconf_client_set_string (client, switch_windows_gconf_key,
++                                     "disabled", NULL);
++        }
++
++      if (global_menu_key == NULL)
++        {
++          global_menu_key =
++            gconf_client_get_string (client, main_menu_gconf_key, NULL);
++
++          if (global_menu_key && strncmp(global_menu_key, "dis", 3))
++            gconf_client_set_string (client, main_menu_gconf_key,
++                                     "disabled", NULL);
++        }
++
++      XUngrabKeyboard (si->dpy, CurrentTime);
++      XFlush (si->dpy);
++    }
++  else if ((strcmp(msg, "ungrab_pointer") == 0))
++    {
++      /* An accessibility helper needs to access the mouse, so we have
++         to release our grab - this is simpler, since we don't worry about
++         mouse gestures that may get through, though maybe we should...
++      */
++
++      XUngrabPointer (si->dpy, CurrentTime);
++      XFlush (si->dpy);
++    }
++  else /* Get a window id of an interesting window from the child */
++    {
++      Window window = strtoul (data, NULL, 0);
++      int status;
++
++      if ((strcmp (msg, "dialog_win") == 0))
++        {
++          /* The unlock dialog itself */
++          si->passwd_dialog = window;
++          pw->got_windowid = True;
++
++          move_mouse_grab (si, si->passwd_dialog, pw->passwd_cursor,
++                           pw->prompt_screen->number);
++          undo_vp_motion (si);
++          passwd_animate_timer ((XtPointer) si, 0);
++
++          /* Flush queue of captured typeahead events */
++          if (si->typeahead_events && si->num_typeahead_events)
++            {
++              int i;
++
++              for (i = 0; i < si->num_typeahead_events; i++)
++                {
++                  si->typeahead_events[i].window = window;
++                  safe_XSendEvent (si->dpy, window, False, KeyPressMask,
++                                   (XEvent *) &si->typeahead_events[i]);
++                }
++              si->num_typeahead_events = 0;
++            }
++          XGrabKeyboard (si->dpy, window, True, GrabModeAsync, GrabModeAsync, CurrentTime);
++          XGrabPointer (si->dpy, window, True, 0, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
++          XFlush (si->dpy);
++          XSetInputFocus (si->dpy, window, RevertToPointerRoot, CurrentTime);
++          XSync (si->dpy, False);
++        }
++      else if ((strcmp (msg, "raise_win") == 0))
++        {
++          /* Accessibility helpers that need to be raised above the
++             full-screen blanking window hiding the user's desktop */
++          Window *newlist;
++          Window overwin;
++
++          if ( (si->num_raise_wins + EXTRA_RAISE_WIN_SLOTS)
++               >= si->max_raise_wins)
++            {
++              int raise_alloc = si->max_raise_wins + WIN_ALLOC_INCREMENT;
++
++              newlist = realloc(si->raise_wins, raise_alloc * sizeof(Window));
++              if (newlist == NULL)
++                return;
++
++              si->raise_wins = newlist;
++              si->max_raise_wins = raise_alloc;
++            }
++
++          overwin = check_raisedWid (si, window);
++          if (overwin)
++            {
++              XWindowAttributes attrs;
++              status = XGetWindowAttributes (si->dpy, overwin, &attrs);
++
++              if ( status && !attrs.override_redirect )
++                {
++                  unsigned long valuemask = CWOverrideRedirect;
++                  XSetWindowAttributes setwinattr;
++                  setwinattr.override_redirect = True;
++
++                  XChangeWindowAttributes (si->dpy, overwin,
++                                           valuemask, &setwinattr);
++
++                  if (si->num_override_wins >= si->max_override_wins)
++                    {
++                      int over_alloc
++                        = si->max_override_wins + WIN_ALLOC_INCREMENT;
++
++                      newlist = realloc(si->override_wins,
++                                        over_alloc * sizeof(Window));
++                      if (newlist == NULL)
++                        return;
++
++                      si->override_wins = newlist;
++                      si->max_override_wins = over_alloc;
++                    }
++
++                  si->override_wins[si->num_override_wins++] = overwin;
++                }
++              XMapSubwindows(si->dpy, overwin);
++              si->raise_wins[si->num_raise_wins++] = overwin;
++            }
++          else
++            si->raise_wins[si->num_raise_wins++] = window;
++        } /* "raise_win" */
++
++      restack_my_windows(si, si->pw_data->prompt_screen, 0);
++    }
++}
++
++/* returns successful fork/exec */
++Bool
++spawn_external_passwd_process (saver_info *si, passwd_dialog_data *pw)
++{
++  saver_preferences *p = &si->prefs;
++  pid_t forked;
++  const char *command = LOCKDIR "/xscreensaver-lock";
++  int stdin_pipe[2]  = { -1, -1 };
++  int stdout_pipe[2] = { -1, -1 };
++
++  si->passwd_pid = 0;
++  pw->stdin_fd = pw->stdout_fd = -1;
++  pw->got_windowid = False;
++
++  if (si->prefs.verbose_p)
++     fprintf(stderr, "-->spawn_external_passwd()\n");
++
++  if (si->passwd_pid > 0)
++    {
++      if (si->prefs.verbose_p)
++        fprintf (stderr,"pid %ld still exists.  Killing it with SIGKILL\n",
++                 si->passwd_pid);
++      kill_job (si, si->passwd_pid, SIGKILL);
++    }
++  si->passwd_pid = 0;
++
++  if (pipe (stdin_pipe) < 0)
++    {
++      perror ("pipe(stdin_pipe) failed!");
++      return False;
++    }
++
++  if (pipe (stdout_pipe) < 0)
++    {
++      perror ("pipe(stdout_pipe) failed!");
++      close_and_invalidate (&stdin_pipe[0]);
++      close_and_invalidate (&stdin_pipe[1]);
++      return False;
++    }
++  switch ((int) (forked = fork ()))
++    {
++    case -1:
++      fprintf (stderr, "%s: ", blurb ());
++      perror ("couldn't fork");
++
++      close_and_invalidate (&stdin_pipe[0]);
++      close_and_invalidate (&stdin_pipe[1]);
++      close_and_invalidate (&stdout_pipe[0]);
++      close_and_invalidate (&stdout_pipe[1]);
++
++      return False;
++
++    case 0:
++      close (ConnectionNumber (si->dpy)); /* close display fd */
++      /* limit_subproc_memory (p->inferior_memory_limit, p->verbose_p); */
++      /* hack_subproc_environment (ssi); */ /* FIX $DISPLAY */
++
++      /* Inside Child Process */
++      if (p->verbose_p)
++        fprintf (stderr, "%s: spawning \"%s\" in pid %lu.\n",
++                 blurb(), command, (unsigned long) getpid ());
++
++      close_and_invalidate (&stdin_pipe[1]);
++      close_and_invalidate (&stdout_pipe[0]);
++
++      sane_dup2 (stdin_pipe[0], 0);  /* Listen to Parent from here */
++      sane_dup2 (stdout_pipe[1], 9); /* Talk to Parent from here */
++
++      /* Make sure we have relinquished setuid privs or lock dialog gtk
++       * program will not run as libgtk is not setuid safe.
++       */
++      hack_uid (si);
++
++      exec_command (p->shell, command, 0);
++      /* print_path_error (command); */
++      fprintf (stderr, "%s: couldn't exec: %s\n",
++               blurb (), command);
++      abort ();
++
++    default:
++      /* In Parent */
++      make_job(forked, 0, command);
++      close_and_invalidate (&stdin_pipe[0]);
++      close_and_invalidate (&stdout_pipe[1]);
++
++      sane_dup2 (stdin_pipe[0], 0);  /* Listen to Child from here */
++      sane_dup2 (stdout_pipe[1], 13); /* Talk to Child from here */
++
++      pw->stdin_fd   = stdin_pipe[1];   /* Talk to child from here */
++      pw->stdout_fd  = stdout_pipe[0];  /* Listen to Child from here */
++      si->passwd_pid = forked;
++
++      /* Messages to child dialog are sent through this pipe/fd */
++      pw->stdin_file = fdopen (pw->stdin_fd, "w");
++      write_to_child (si, "Hello", NULL); /* Send a test message to Child */
++
++      /* Password from child dialog comes through this pipe/fd */
++      pw->stdout_file = fdopen (pw->stdout_fd, "r");
++
++      pw->stdout_input_id = XtAppAddInput (si->app, pw->stdout_fd,
++                                           (XtPointer) XtInputReadMask,
++                                           handle_passwd_input, si);
++
++      /* Set global flag to indicate that lock dialog is visible */
++      g_passwd_dialog_created = True;
++      return True;
++    }
++
++  /* shouldn't reach */
++  abort ();
++  return False;
++}
++#endif /* HAVE_XSCREENSAVER_LOCK */
++
+ static int
+ new_passwd_window (saver_info *si)
+ {
+   passwd_dialog_data *pw;
++#ifndef HAVE_XSCREENSAVER_LOCK
+   Screen *screen;
+   Colormap cmap;
+   char *f;
++#endif
+   saver_screen_info *ssi = &si->screens [mouse_screen (si)];
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++  /* si->pw_data is globally allocated and never freed when HAVE_XSS_LOCK */
++  pw = si->pw_data;
++  if (!spawn_external_passwd_process (si, pw))
++    return -1;
++  si->external_passwd = True;
++#else
+   pw = (passwd_dialog_data *) calloc (1, sizeof(*pw));
+   if (!pw)
+     return -1;
[email protected]@ -211,17 +721,21 @@ new_passwd_window (saver_info *si)
+    */
+   pw->login_button_p = (si->prefs.new_login_command &&
+                         *si->prefs.new_login_command);
++#endif
+ 
+   pw->passwd_cursor = XCreateFontCursor (si->dpy, XC_top_left_arrow);
+ 
+   pw->prompt_screen = ssi;
+ 
++#ifndef HAVE_XSCREENSAVER_LOCK
+   screen = pw->prompt_screen->screen;
+   cmap = DefaultColormapOfScreen (screen);
++#endif
+ 
+   pw->show_stars_p = get_boolean_resource(si->dpy, "passwd.asterisks", 
+ 					  "Boolean");
+   
++#ifndef HAVE_XSCREENSAVER_LOCK
+   pw->heading_label = get_string_resource (si->dpy, "passwd.heading.label",
+ 					   "Dialog.Label.Label");
+   pw->body_label = get_string_resource (si->dpy, "passwd.body.label",
[email protected]@ -376,6 +890,7 @@ new_passwd_window (saver_info *si)
+   if (pw->shadow_width == 0) pw->shadow_width = 4;
+   if (pw->thermo_width == 0) pw->thermo_width = pw->shadow_width;
+ 
++#endif /* ! HAVE_XSCREENSAVER_LOCK */
+ 
+   /* We need to remember the mouse position and restore it afterward, or
+      sometimes (perhaps only with Xinerama?) the mouse gets warped to
[email protected]@ -442,12 +957,16 @@ make_passwd_window (saver_info *si,
+ 		    const char *prompt,
+ 		    Bool echo)
+ {
++#ifndef HAVE_XSCREENSAVER_LOCK
+   XSetWindowAttributes attrs;
+   unsigned long attrmask = 0;
++#endif
+   passwd_dialog_data *pw;
++#ifndef HAVE_XSCREENSAVER_LOCK
+   Screen *screen;
+   Colormap cmap;
+   Dimension max_string_width_px;
++#endif
+   saver_screen_info *ssi = &si->screens [mouse_screen (si)];
+ 
+   cleanup_passwd_window (si);
[email protected]@ -455,7 +974,12 @@ make_passwd_window (saver_info *si,
+   if (! ssi)   /* WTF?  Trying to prompt while no screens connected? */
+     return -1;
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++  /* si->pw_data is globally allocated and never freed when HAVE_XSS_LOCK */
++  if (!si->pw_data->got_windowid)
++#else
+   if (!si->pw_data)
++#endif
+     if (new_passwd_window (si) < 0)
+       return -1;
+ 
[email protected]@ -470,6 +994,29 @@ make_passwd_window (saver_info *si,
+              blurb(), pw->prompt_screen->number,
+              info_msg ? info_msg : "");
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++  /* Wipe the old password, so we get prompted to enter new password. */
++  if (pw->passwd_string)
++    {
++      memset(pw->passwd_string, 0, strlen (pw->passwd_string));
++      free (pw->passwd_string);
++      pw->passwd_string = NULL;
++    }
++
++  if (info_msg)
++    write_to_child (si, "ul_message", info_msg);
++  if (prompt)
++    {
++      write_to_child (si, "ul_pamprompt", prompt);
++
++      if (echo)
++        write_to_child (si, "ul_prompt_echo", "true");
++      else if (pw->show_stars_p)
++        write_to_child (si, "ul_prompt_echo", "stars");
++      else
++        write_to_child (si, "ul_prompt_echo", "false");
++    }
++#else
+   screen = pw->prompt_screen->screen;
+   cmap = DefaultColormapOfScreen (screen);
+ 
[email protected]@ -721,11 +1268,13 @@ make_passwd_window (saver_info *si,
+   if (cmap)
+     XInstallColormap (si->dpy, cmap);
+   draw_passwd_window (si);
++#endif /* ! HAVE_XSCREENSAVER_LOCK */
+ 
+   return 0;
+ }
+ 
+ 
++#ifndef HAVE_XSCREENSAVER_LOCK
+ static void
+ draw_passwd_window (saver_info *si)
+ {
[email protected]@ -1071,17 +1620,48 @@ draw_button(Display *dpy,
+   draw_shaded_rectangle(dpy, dialog, x, y, width, height,
+ 			shadow_width, shadow_light, shadow_dark);
+ }
++#endif /* !HAVE_XSCREENSAVER_LOCK */
+ 
+ static void
+ update_passwd_window (saver_info *si, const char *printed_passwd, float ratio)
+ {
+   passwd_dialog_data *pw = si->pw_data;
++#ifndef HAVE_XSCREENSAVER_LOCK
+   XGCValues gcv;
+   GC gc1, gc2;
+   int x, y;
+   XRectangle rects[1];
++#endif
+ 
+   pw->ratio = ratio;
++
++#ifdef HAVE_XSCREENSAVER_LOCK
++  /* Send countdown timer ratio to child lock dialog */
++  if (si->passwd_dialog)
++    {
++      XEvent event;
++
++      event.xany.type = ClientMessage;
++      event.xclient.display = si->dpy;
++      event.xclient.window = si->passwd_dialog;
++      event.xclient.message_type = XA_UNLOCK_RATIO;
++      event.xclient.format = 32;
++      memset (&event.xclient.data, 0, sizeof (event.xclient.data));
++      event.xclient.data.l[0] = (long)(pw->ratio * 100);
++      event.xclient.data.l[1] = 0;
++      event.xclient.data.l[2] = 0;
++
++      if (!safe_XSendEvent (si->dpy, si->passwd_dialog, False, 0L, &event))
++        fprintf (stderr, "%s: error sending ratio to lock dialog\n", blurb ());
++    }
++  else
++    {
++      if (si->prefs.verbose_p)
++        fprintf (stderr,
++          "-->update_passwd_window() lockdialog not created, returning!!\n");
++      return;
++    }
++#else
+   gcv.foreground = pw->passwd_foreground;
+   gcv.font = pw->passwd_font->fid;
+   gc1 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground|GCFont, &gcv);
[email protected]@ -1226,6 +1806,7 @@ update_passwd_window (saver_info *si, const char *printed_passwd, float ratio)
+   XFreeGC (si->dpy, gc1);
+   XFreeGC (si->dpy, gc2);
+   XSync (si->dpy, False);
++#endif /* !HAVE_XSCREENSAVER_LOCK */
+ }
+ 
+ 
[email protected]@ -1257,6 +1838,9 @@ cleanup_passwd_window (saver_info *si)
+ {
+   passwd_dialog_data *pw;
+ 
++  if (si->prefs.verbose_p)
++    fprintf (stderr, "cleanup_passwd_window\n");
++
+   if (!(pw = si->pw_data))
+     return;
+ 
[email protected]@ -1274,7 +1858,13 @@ cleanup_passwd_window (saver_info *si)
+ 
+   memset (pw->typed_passwd, 0, sizeof(pw->typed_passwd));
+   memset (pw->typed_passwd_char_size, 0, sizeof(pw->typed_passwd_char_size));
+-  memset (pw->passwd_string, 0, strlen(pw->passwd_string));
++  if (pw->passwd_string)
++    {
++      memset (pw->passwd_string, 0, strlen(pw->passwd_string));
++      free (pw->passwd_string);
++      pw->passwd_string = NULL;
++    }
++
+ 
+   if (pw->timer)
+     {
[email protected]@ -1297,8 +1887,10 @@ destroy_passwd_window (saver_info *si)
+   passwd_dialog_data *pw = si->pw_data;
+   saver_screen_info *ssi = pw->prompt_screen;
+   Colormap cmap = DefaultColormapOfScreen (ssi->screen);
++#ifndef HAVE_XSCREENSAVER_LOCK
+   Pixel black = BlackPixelOfScreen (ssi->screen);
+   Pixel white = WhitePixelOfScreen (ssi->screen);
++#endif
+   XEvent event;
+ 
+   cleanup_passwd_window (si);
[email protected]@ -1314,6 +1906,81 @@ destroy_passwd_window (saver_info *si)
+       si->cached_passwd = NULL;
+     }
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++  /* reset global flag to indicate passwd dialog is no longer there */
++  g_passwd_dialog_created = False;
++
++  if (si->external_passwd)
++    {
++      /* kill the child etc. */
++      write_to_child (si, "cmd_exit", NULL);
++
++      if (pw->stdin_file)
++        fclose (pw->stdin_file);
++      if (pw->stdin_fd != -1)
++        close_and_invalidate (&pw->stdin_fd);
++      if (pw->stdout_input_id)
++        XtRemoveInput (pw->stdout_input_id);
++      if (pw->stdout_file)
++        fclose (pw->stdout_file);
++      else if (pw->stdout_fd != -1)
++        close_and_invalidate (&pw->stdout_fd);
++
++      if (si->passwd_pid)
++        {
++          kill_job (si, si->passwd_pid, SIGTERM);
++          si->passwd_pid = 0;
++        }
++
++      free (si->raise_wins);
++      si->raise_wins = NULL;
++      si->num_raise_wins = 0;
++      si->max_raise_wins = 0;
++
++      if (si->override_wins)
++        {
++          int n;
++
++          unsigned long valuemask = CWOverrideRedirect;
++          XSetWindowAttributes setwinattr;
++          setwinattr.override_redirect = False;
++
++          for (n = 0; n < si->num_override_wins; n++)
++            {
++              XChangeWindowAttributes (si->dpy, si->override_wins[n],
++                                       valuemask, &setwinattr);
++            }
++          free(si->override_wins);
++          si->override_wins = NULL;
++        }
++      si->num_override_wins = 0;
++      si->max_override_wins = 0;
++
++      si->pw_data->got_windowid = False;
++      si->external_passwd = False;
++
++      /* restore any metacity keys we temporarily disabled */
++      if (client)
++        {
++          if (global_switch_key)
++            {
++              gconf_client_set_string (client, switch_windows_gconf_key,
++                                       global_switch_key, NULL);
++              g_free(global_switch_key);
++              global_switch_key = NULL;
++            }
++
++          if (global_menu_key)
++            {
++              gconf_client_set_string (client, main_menu_gconf_key,
++                                       global_menu_key, NULL);
++              g_free(global_menu_key);
++              global_menu_key = NULL;
++            }
++        }
++    }
++#endif /* HAVE_XSCREENSAVER_LOCK */
++
+   move_mouse_grab (si, RootWindowOfScreen (ssi->screen),
+                    ssi->cursor, ssi->number);
+ 
[email protected]@ -1348,7 +2015,14 @@ destroy_passwd_window (saver_info *si)
+         fprintf (stderr, "%s: %d: destroying password dialog.\n",
+                  blurb(), pw->prompt_screen->number);
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++      /* Ignore X error if window was already closed by the child,
++         and make sure any VisibilityNotify events are removed
++         from the event queue before we forget the window id. */
++      safe_XDestroyWindow (si->dpy, si->passwd_dialog);
++#else
+       XDestroyWindow (si->dpy, si->passwd_dialog);
++#endif
+       si->passwd_dialog = 0;
+     }
+   
[email protected]@ -1359,6 +2033,7 @@ destroy_passwd_window (saver_info *si)
+       pw->save_under = 0;
+     }
+ 
++#ifndef HAVE_XSCREENSAVER_LOCK
+   if (pw->heading_label) free (pw->heading_label);
+   if (pw->body_label)    free (pw->body_label);
+   if (pw->user_label)    free (pw->user_label);
[email protected]@ -1409,6 +2084,7 @@ destroy_passwd_window (saver_info *si)
+       pw->logo_pixels = 0;
+       pw->logo_npixels = 0;
+     }
++#endif /* ! HAVE_XSCREENSAVER_LOCK */
+ 
+   if (pw->save_under)
+     XFreePixmap (si->dpy, pw->save_under);
[email protected]@ -1416,9 +2092,12 @@ destroy_passwd_window (saver_info *si)
+   if (cmap)
+     XInstallColormap (si->dpy, cmap);
+ 
++#ifndef HAVE_XSCREENSAVER_LOCK
++  /* si->pw_data is globally allocated and never freed when HAVE_XSS_LOCK */
+   memset (pw, 0, sizeof(*pw));
+   free (pw);
+   si->pw_data = 0;
++#endif
+ }
+ 
+ 
[email protected]@ -1435,6 +2114,49 @@ ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error)
+ 
+ #endif /* HAVE_XF86MISCSETGRABKEYSSTATE || HAVE_XF86VMODE */
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++/* Catch errors from XRestackWindows, since there's an inherent race
++   condition in which other clients can destroy windows between when
++   we get the notification event and when we send the RestackWindows
++   response to it. */
++static Bool
++safe_XRestackWindows(Display *dpy, Window windows[], int nwindows)
++{
++  XErrorHandler old_handler;
++  XSync (dpy, False);
++  error_handler_hit_p = False;
++  old_handler = XSetErrorHandler (ignore_all_errors_ehandler);
++
++  XRestackWindows (dpy, windows, nwindows);
++
++  XSync (dpy, False);
++  XSetErrorHandler (old_handler);
++  XSync (dpy, False);
++
++  return (!error_handler_hit_p);
++}
++
++static Bool
++safe_XSendEvent(Display *dpy, Window w, Bool propagate,
++                long event_mask, XEvent *event_send)
++{
++  Status status;
++  XErrorHandler old_handler;
++  XSync (dpy, False);
++  error_handler_hit_p = False;
++  old_handler = XSetErrorHandler (ignore_all_errors_ehandler);
++
++  status = XSendEvent (dpy, w, propagate, event_mask, event_send);
++
++  XSync (dpy, False);
++  XSetErrorHandler (old_handler);
++  XSync (dpy, False);
++
++  return (!error_handler_hit_p && status);
++}
++
++#endif
++
+ 
+ #ifdef HAVE_XHPDISABLERESET
+ /* This function enables and disables the C-Sh-Reset hot-key, which
[email protected]@ -1636,6 +2358,17 @@ passwd_animate_timer (XtPointer closure, XtIntervalId *id)
+ 
+   if (!pw) return;
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++  /* We want to make sure dialog is up before we update countdown timer */
++  if (!si->passwd_dialog)
++    {
++      if (si->prefs.verbose_p)
++        fprintf (stderr,
++                 "-->passwd_animate_timer() returning..no dialog yet\n");
++      return;
++    }
++#endif
++
+   pw->ratio -= (1.0 / ((double) si->prefs.passwd_timeout / (double) tick));
+   if (pw->ratio < 0)
+     {
[email protected]@ -1655,6 +2388,7 @@ passwd_animate_timer (XtPointer closure, XtIntervalId *id)
+   idle_timer ((XtPointer) si, 0);
+ }
+ 
++#ifndef HAVE_XSCREENSAVER_LOCK
+ 
+ static XComposeStatus *compose_status;
+ 
[email protected]@ -1732,6 +2466,7 @@ finished_typing_passwd (saver_info *si, passwd_dialog_data *pw)
+       update_passwd_window (si, "", pw->ratio);
+     }
+ }
++#endif /* !HAVE_XSCREENSAVER_LOCK */
+ 
+ static void
+ handle_passwd_key (saver_info *si, XKeyEvent *event)
[email protected]@ -1739,7 +2474,8 @@ handle_passwd_key (saver_info *si, XKeyEvent *event)
+   passwd_dialog_data *pw = si->pw_data;
+   unsigned char decoded [MAX_BYTES_PER_CHAR * 10]; /* leave some slack */
+   KeySym keysym = 0;
+-
++#ifndef HAVE_XSCREENSAVER_LOCK
++ 
+   /* XLookupString may return more than one character via XRebindKeysym;
+      and on some systems it returns multi-byte UTF-8 characters (contrary
+      to its documentation, which says it returns only Latin1.)
[email protected]@ -1773,11 +2509,40 @@ handle_passwd_key (saver_info *si, XKeyEvent *event)
+ 
+   decoded[decoded_size] = 0;
+   pw->passwd_changed_p = True;
++#endif /* !HAVE_XSCREENSAVER_LOCK */
+ 
+   /* Add 10% to the time remaining every time a key is pressed. */
+   pw->ratio += 0.1;
+   if (pw->ratio > 1) pw->ratio = 1;
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++  if (si->pw_data->got_windowid)
++    {
++      Bool status;
++
++      if (si->prefs.verbose_p)
++        fprintf (stderr, "event loop..gotwindowid..and keypress event...\n");
++
++      event->window = si->passwd_dialog;
++
++      status = safe_XSendEvent (si->dpy, si->passwd_dialog,
++                                False, KeyPressMask, (XEvent *) event);
++
++      if (si->prefs.verbose_p)
++        {
++          if (status)
++            fprintf (stderr, "sent key...\n");
++          else
++            fprintf (stderr, "error %d sending key...\n", status);
++        }
++      update_passwd_window (si, NULL, pw->ratio);
++    }
++  else
++    {
++      swallow_unlock_typeahead_events (si, (XEvent *) event);
++    }
++
++#else /* !HAVE_XSCREENSAVER_LOCK */
+   if (decoded_size == 1)		/* Handle single-char commands */
+     {
+       switch (*decoded)
[email protected]@ -1867,6 +2632,7 @@ handle_passwd_key (saver_info *si, XKeyEvent *event)
+     {
+       update_passwd_window (si, "", pw->ratio);
+     }
++#endif /* !HAVE_XSCREENSAVER_LOCK */
+ }
+ 
+ 
[email protected]@ -1890,7 +2656,9 @@ passwd_event_loop (saver_info *si)
+   passwd_animate_timer ((XtPointer) si, 0);
+   reset_watchdog_timer (si, False);	/* Disable watchdog while dialog up */
+ 
+-  while (si->unlock_state == ul_read)
++  si->pw_data->got_passwd = FALSE;
++
++  while (si->unlock_state == ul_read && si->pw_data->got_passwd == FALSE)
+     {
+       XtAppNextEvent (si->app, &event.x_event);
+ 
[email protected]@ -1931,12 +2699,17 @@ passwd_event_loop (saver_info *si)
+ 
+       if (event.x_event.xany.window == si->passwd_dialog && 
+           event.x_event.xany.type == Expose)
++#ifdef HAVE_XSCREENSAVER_LOCK
++	XtDispatchEvent (&event.x_event);
++#else
+ 	draw_passwd_window (si);
++#endif /* !HAVE_XSCREENSAVER_LOCK */
+       else if (event.x_event.xany.type == KeyPress)
+         {
+           handle_passwd_key (si, &event.x_event.xkey);
+           si->pw_data->caps_p = (event.x_event.xkey.state & LockMask);
+         }
++#ifndef HAVE_XSCREENSAVER_LOCK
+       else if (event.x_event.xany.type == ButtonPress || 
+                event.x_event.xany.type == ButtonRelease)
+ 	{
[email protected]@ -1945,6 +2718,82 @@ passwd_event_loop (saver_info *si)
+ 	  if (si->pw_data->login_button_p)
+ 	    handle_login_button (si, &event.x_event);
+ 	}
++#endif /* !HAVE_XSCREENSAVER_LOCK */
++
++ /*
++  5077974 P1 "Bug 147583: Screen Lock unlocks because of GOK dwell movement in
++		core pointer mode"
++
++  ScreenLock did not unlock the screen, but WM's XRestackWindow() did.
++  Once WM/metacity fixes the problem, the code can be removed.
++  The problem:
++    repositioning the Wids in the wrong positions when
++    1. the window type is changed from NORMAL to DOCK or vice versa
++    2. the Wid is managed
++    within the X window stack with or without screen-lock in a mixed Wids
++  there are two temp. get-around solutions:
++    1. non-managed GOK or MAG Wid
++    or
++    2. screensaver picks up the WM's restacking task and fixes the prevous
++       restacking problem.
++       the cons: there is a flashing screen when corepointer is touching
++       GOK or MAG and mouse is moved in a fast way
++       when GOK or MAG window type is DOCK only.
++       and it is not a good temp. get-around solution.
++       This is the only choice if WM did not want to fix the problem now
++       and AT group did not want to use non-managed Wids.
++       Now, GOK only supports 2nd USB/mouse/Dwell, corepointer is supposed
++       not to be used, and GOK cannot disable it
++ */
++/*
++     bugid 6769901,6839026: popup windows appearing through xscreensaver
++*/
++      else if (((event.x_event.xany.type == UnmapNotify)
++             || (event.x_event.xany.type == MapNotify)
++             || (event.x_event.xany.type == VisibilityNotify)
++             || (event.x_event.xany.type == ConfigureNotify)
++             || (event.x_event.xany.type == PropertyNotify)
++             || (event.x_event.xany.type == CreateNotify)
++             || (event.x_event.xany.type == ReparentNotify))
++             && (si->passwd_dialog))
++        {
++          /* Find the handle of popup window
++           * Note: we can not get handle of popup window with
++           * event.xany.window, thats why we have switch cases.
++           */
++          Window wPopWin = 0;
++
++          switch(event.x_event.xany.type)
++            {
++            case ConfigureNotify:
++              wPopWin = event.x_event.xconfigure.window;
++              break;
++            case CreateNotify:
++              wPopWin = event.x_event.xcreatewindow.window;
++              break;
++            case VisibilityNotify:
++              wPopWin = event.x_event.xvisibility.window;
++              break;
++            default:
++              break;
++            }
++
++          if (wPopWin)
++            {
++              saver_screen_info *ssi = find_screen_for_window (si, wPopWin);
++
++              /* This if case is for safety, it prevent screensaver stuck in
++               * loop of ConfigureNotify
++               */
++              if ((wPopWin != si->passwd_dialog) && (ssi != NULL) &&
++                  (wPopWin != ssi->screensaver_window) &&
++                  (wPopWin != ssi->stderr_overlay_window))
++                {
++                  restack_my_windows(si, ssi, wPopWin);
++                }
++            }
++        }
++        /* the above new code for restacking under the condition */
+       else
+ 	XtDispatchEvent (&event.x_event);
+     }
[email protected]@ -1970,8 +2819,13 @@ passwd_event_loop (saver_info *si)
+ 
+   if (msg)
+     {
++#ifdef HAVE_XSCREENSAVER_LOCK
++      write_to_child (si, "ul_message", msg);
++      usleep (250000);  /* 1/4 second */
++#else
+       si->pw_data->i_beam = 0;
+       update_passwd_window (si, msg, 0.0);
++#endif
+       XSync (si->dpy, False);
+ 
+       /* Swallow all pending KeyPress/KeyRelease events. */
[email protected]@ -1989,6 +2843,10 @@ passwd_event_loop (saver_info *si)
+ static void
+ handle_typeahead (saver_info *si)
+ {
++/* HAVE_XSCREENSAVER_LOCK: typeahead events are flushed to the external
++   dialog program in handle_passwd_input when we get the dialog_win notice
++   that it has created the window */
++#ifndef HAVE_XSCREENSAVER_LOCK
+   passwd_dialog_data *pw = si->pw_data;
+   int i;
+   if (!si->unlock_typeahead)
[email protected]@ -2016,6 +2874,7 @@ handle_typeahead (saver_info *si)
+ 
+   free (si->unlock_typeahead);
+   si->unlock_typeahead = 0;
++#endif
+ }
+ 
+ 
[email protected]@ -2121,9 +2980,11 @@ gui_auth_conv(int num_msg,
+ 	  free(prompt_trimmed);
+       }
+ 
++#ifndef HAVE_XSCREENSAVER_LOCK
+       compose_status = calloc (1, sizeof (*compose_status));
+       if (!compose_status)
+ 	goto fail;
++#endif
+ 
+       si->unlock_state = ul_read;
+ 
[email protected]@ -2133,7 +2994,14 @@ gui_auth_conv(int num_msg,
+       if (si->unlock_state == ul_cancel)
+ 	goto fail;
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++      if ((si->unlock_state != ul_time) && si->pw_data->passwd_string)
++        responses[i].response = strdup (si->pw_data->passwd_string);
++      else
++        goto fail;
++#else
+       responses[i].response = strdup(si->pw_data->typed_passwd);
++#endif
+ 
+       /* Cache the first response to a PROMPT_NOECHO to save prompting for
+        * each auth mechanism. */
[email protected]@ -2141,8 +3009,10 @@ gui_auth_conv(int num_msg,
+ 	  auth_msgs[i].type == AUTH_MSGTYPE_PROMPT_NOECHO)
+ 	si->cached_passwd = strdup(responses[i].response);
+ 
++#ifndef HAVE_XSCREENSAVER_LOCK
+       free (compose_status);
+       compose_status = 0;
++#endif
+     }
+ 
+   *resp = responses;
[email protected]@ -2150,9 +3020,11 @@ gui_auth_conv(int num_msg,
+   return (si->unlock_state == ul_finished) ? 0 : -1;
+ 
+ fail:
++#ifndef HAVE_XSCREENSAVER_LOCK
+   if (compose_status)
+     free (compose_status);
+   compose_status = 0;
++#endif
+ 
+   if (responses)
+     {
[email protected]@ -2213,11 +3085,14 @@ auth_finished_cb (saver_info *si)
+       if (XPending (si->dpy))
+         {
+           XNextEvent (si->dpy, &event);
++#ifndef HAVE_XSCREENSAVER_LOCK
+           if (event.xany.window == si->passwd_dialog && 
+               event.xany.type == Expose)
+             draw_passwd_window (si);
+-          else if (event.xany.type == ButtonPress || 
+-                   event.xany.type == KeyPress)
++          else
++#endif
++            if (event.xany.type == ButtonPress ||
++                event.xany.type == KeyPress)
+             break;
+           XSync (si->dpy, False);
+         }
[email protected]@ -2226,7 +3101,7 @@ auth_finished_cb (saver_info *si)
+   }
+ 
+  END:
+-  if (si->pw_data)
++  if (si->pw_data && si->pw_data->prompt_screen)
+     destroy_passwd_window (si);
+ }
+ 
+diff --git a/driver/passwd-pam.c b/driver/passwd-pam.c
+index 0c60d50..93c73f1 100644
+--- a/driver/passwd-pam.c
++++ b/driver/passwd-pam.c
[email protected]@ -39,10 +39,16 @@
+ #ifndef NO_LOCKING  /* whole file */
+ 
+ #include <stdlib.h>
++#include <xscreensaver-intl.h>
++
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
+ 
++#ifdef __sun
++# include <deflt.h>
++#endif
++
+ extern char *blurb(void);
+ 
+ 
[email protected]@ -58,6 +64,7 @@ extern char *blurb(void);
+ 
+ #include <sys/stat.h>
+ 
++#include "dialog-data.h"
+ #include "auth.h"
+ 
+ extern sigset_t block_sigchld (void);
[email protected]@ -82,7 +89,10 @@ extern void unblock_sigchld (void);
+ #endif
+ 
+ static int pam_conversation (int nmsgs,
+-                             const struct pam_message **msg,
++#ifndef __sun
++                             const
++#endif
++                             struct pam_message **msg,
+                              struct pam_response **resp,
+                              void *closure);
+ 
[email protected]@ -183,6 +193,11 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+   struct pam_conv pc;
+   sigset_t set;
+   struct timespec timeout;
++  int pam_auth_status = 0;  /* Specific for pam_authenticate() status*/
++  int acct_rc, setcred_rc, chauth_rc;
++  int pam_flags = 0;
++
++  uid_t euid = geteuid();
+ 
+   pc.conv = &pam_conversation;
+   pc.appdata_ptr = (void *) si;
[email protected]@ -191,6 +206,23 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+      `closure' argument to pc.conv always comes in as random garbage. */
+   suns_pam_implementation_blows = (void *) si;
+ 
++#ifdef __sun
++  if (verbose_p)
++    fprintf (stderr, "Before uid=%d euid=%d \n\n", getuid(), geteuid());
++
++  if (seteuid (0) != 0)
++    {
++      if (verbose_p)
++        perror("Could not change euid to root, pam may not work!\n");
++    }
++
++  if (verbose_p)
++    {
++      fprintf (stderr, "After seteuid(0) uid=%d euid=%d \n\n",
++               getuid(), geteuid());
++      fprintf (stderr, "PAM is using SERVICE_NAME=\"%s\"\n\n", service);
++    }
++#endif
+ 
+   /* Initialize PAM.
+    */
[email protected]@ -201,11 +233,35 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+              status, PAM_STRERROR (pamh, status));
+   if (status != PAM_SUCCESS) goto DONE;
+ 
++#ifdef __sun
++  /* Check /etc/default/login to see if we should add
++     PAM_DISALLOW_NULL_AUTHTOK to pam_flags */
++  if (defopen("/etc/default/login") == 0) {
++    char *ptr;
++    int flags = defcntl(DC_GETFLAGS, 0);
++
++    TURNOFF(flags, DC_CASE);
++    (void) defcntl(DC_SETFLAGS, flags);
++    if ((ptr = defread("PASSREQ=")) != NULL &&
++        strcasecmp("YES", ptr) == 0)
++      {
++        pam_flags |= PAM_DISALLOW_NULL_AUTHTOK;
++      }
++
++    (void) defopen((char *)NULL); /* close current file */
++  }
++#endif
++
+   /* #### We should set PAM_TTY to the display we're using, but we
+      don't have that handy from here.  So set it to :0.0, which is a
+      good guess (and has the bonus of counting as a "secure tty" as
+      far as PAM is concerned...)
+    */
++
++/* From the pam trace and log file, it is found out that the
++   Sun pam modules can drive itself.
++*/
++#ifndef __sun
+   {
+     char *tty = strdup (":0.0");
+     status = pam_set_item (pamh, PAM_TTY, tty);
[email protected]@ -214,6 +270,7 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+                blurb(), tty, status, PAM_STRERROR(pamh, status));
+     free (tty);
+   }
++#endif
+ 
+   /* Try to authenticate as the current user.
+      We must turn off our SIGCHLD handler for the duration of the call to
[email protected]@ -243,56 +300,102 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+   timeout.tv_sec = 0;
+   timeout.tv_nsec = 1;
+   set = block_sigchld();
+-  status = pam_authenticate (pamh, 0);
++  pam_auth_status = pam_authenticate (pamh, pam_flags);
+ # ifdef HAVE_SIGTIMEDWAIT
+   sigtimedwait (&set, NULL, &timeout);
+   /* #### What is the portable thing to do if we don't have it? */
+ # endif /* HAVE_SIGTIMEDWAIT */
+   unblock_sigchld();
+ 
+-  if (verbose_p)
+-    fprintf (stderr, "%s:   pam_authenticate (...) ==> %d (%s)\n",
+-             blurb(), status, PAM_STRERROR(pamh, status));
+-
+-  if (status == PAM_SUCCESS)  /* Win! */
++#ifdef HAVE_XSCREENSAVER_LOCK
++  /* Send status message to unlock dialog */
++  if (pam_auth_status == PAM_SUCCESS)
+     {
+-      int status2;
+-
+-      /* On most systems, it doesn't matter whether the account modules
+-         are run, or whether they fail or succeed.
++      if (verbose_p)
++        write_to_child (si, "ul_ok", PAM_STRERROR (pamh, pam_auth_status));
++    }
++  else if (si->unlock_state != ul_cancel && si->unlock_state != ul_time)
++    {
++      write_to_child (si, "ul_fail", PAM_STRERROR (pamh, pam_auth_status));
++    }
++  if (verbose_p)
++    sleep (1);
++#endif
+ 
+-         On some systems, the account modules fail, because they were
+-         never configured properly, but it's necessary to run them anyway
+-         because certain PAM modules depend on side effects of the account
+-         modules having been run.
++  if (verbose_p)
++      fprintf (stderr, "after calling pam_authenticate state is: %s\n",
++               si->unlock_state == ul_success ? "ul_success" : "ul_fail");
+ 
+-         And on still other systems, the account modules are actually
+-         used, and failures in them should be considered to be true!
++  if (verbose_p)
++    fprintf (stderr, "%s:   pam_authenticate (...) ==> %d (%s)\n",
++             blurb(), pam_auth_status, PAM_STRERROR(pamh, pam_auth_status));
+ 
+-         So:
+-         - We run the account modules on all systems.
+-         - Whether we ignore them is a configure option.
++  if (pam_auth_status == PAM_SUCCESS)  /* Win! */
++    {
++      /* perform PAM account validation procedures for login user only */
++      acct_rc   = pam_acct_mgmt(pamh, pam_flags);
+ 
+-         It's all kind of a mess.
+-       */
+-      status2 = pam_acct_mgmt (pamh, 0);
++      /******************************************************************
++           ignore other cases for the time being
++           PAM_USER_UNKNOWN, PAM_AUTH_ERR, PAM_ACCT_EXPIRED
++           (password mgn service module)
++           same as pam_setcred(), focus on auth. service module only
++       *****************************************************************/
+ 
+       if (verbose_p)
+         fprintf (stderr, "%s:   pam_acct_mgmt (...) ==> %d (%s)\n",
+-                 blurb(), status2, PAM_STRERROR(pamh, status2));
++                 blurb(), acct_rc, PAM_STRERROR(pamh, acct_rc));
++
++#ifdef HAVE_XSCREENSAVER_LOCK
++      /* Send status message to unlock dialog ***/
++      if (acct_rc == PAM_SUCCESS)
++        {
++          if (verbose_p)
++            write_to_child (si, "ul_acct_ok", PAM_STRERROR(pamh, acct_rc));
++        }
++      else
++        write_to_child (si, "ul_acct_fail", PAM_STRERROR(pamh, acct_rc));
++      if (verbose_p)
++        sleep (1);
++#endif
+ 
+       /* HPUX for some reason likes to make PAM defines different from
+        * everyone else's. */
+ #ifdef PAM_AUTHTOKEN_REQD
+-      if (status2 == PAM_AUTHTOKEN_REQD)
++      if (acct_rc == PAM_AUTHTOKEN_REQD)
+ #else
+-      if (status2 == PAM_NEW_AUTHTOK_REQD)
++      if (acct_rc == PAM_NEW_AUTHTOK_REQD)
+ #endif
+         {
+-          status2 = pam_chauthtok (pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
++          int i;
++          for (i = 0; i < 3; i++)
++            {
++              chauth_rc  = pam_chauthtok (pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
++              if (chauth_rc == PAM_AUTHTOK_ERR ||
++                  chauth_rc  == PAM_TRY_AGAIN )
++                {
++                  i = 0;
++                  si->unlock_state = ul_read;
++                }
++              else break; /* get out of the loop */
++            }
++
+           if (verbose_p)
+             fprintf (stderr, "%s: pam_chauthtok (...) ==> %d (%s)\n",
+-                     blurb(), status2, PAM_STRERROR(pamh, status2));
++                     blurb(), chauth_rc, PAM_STRERROR(pamh, chauth_rc));
++
++          if (chauth_rc != PAM_SUCCESS)
++            {
++              pam_auth_status = chauth_rc;
++              goto DONE;
++            }
++        }
++      else if (acct_rc != PAM_SUCCESS)
++        {
++          pam_auth_status = acct_rc;
++          write_to_child (si, "pw_acct_fail", PAM_STRERROR(pamh, acct_rc));
++          sleep (3);
++          goto DONE;
+         }
+ 
+       /* If 'configure' requested that we believe the results of PAM
[email protected]@ -306,30 +409,68 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+       /* Each time we successfully authenticate, refresh credentials,
+          for Kerberos/AFS/DCE/etc.  If this fails, just ignore that
+          failure and blunder along; it shouldn't matter.
+-
++      */
++#ifdef __linux__
++      /*
+          Note: this used to be PAM_REFRESH_CRED instead of
+          PAM_REINITIALIZE_CRED, but Jason Heiss <[email protected]>
+          says that the Linux PAM library ignores that one, and only refreshes
+          credentials when using PAM_REINITIALIZE_CRED.
+        */
+-      status2 = pam_setcred (pamh, PAM_REINITIALIZE_CRED);
++      setcred_rc = pam_setcred (pamh, PAM_REINITIALIZE_CRED);
++#else
++      setcred_rc = pam_setcred (pamh, PAM_REFRESH_CRED);
++#endif
+       if (verbose_p)
+         fprintf (stderr, "%s:   pam_setcred (...) ==> %d (%s)\n",
+-                 blurb(), status2, PAM_STRERROR(pamh, status2));
++                 blurb(), setcred_rc, PAM_STRERROR(pamh, setcred_rc));
++
++#ifdef HAVE_XSCREENSAVER_LOCK
++      /* Send status message to unlock dialog ***/
++      if (setcred_rc == PAM_SUCCESS)
++        {
++          if (verbose_p)
++            write_to_child (si, "ul_setcred_ok", PAM_STRERROR(pamh, setcred_rc));
++        }
++      else
++        write_to_child (si, "ul_setcred_fail", PAM_STRERROR(pamh, setcred_rc));
++      if (verbose_p)
++        sleep (1);
++#endif
+     }
+ 
+  DONE:
+   if (pamh)
+     {
+-      int status2 = pam_end (pamh, status);
+-      pamh = 0;
++      int status2 = pam_end (pamh, pam_auth_status);
++      pamh = NULL;
+       if (verbose_p)
+         fprintf (stderr, "%s: pam_end (...) ==> %d (%s)\n",
+                  blurb(), status2,
+                  (status2 == PAM_SUCCESS ? "Success" : "Failure"));
+     }
+ 
+-  if (status == PAM_SUCCESS)
++  if (seteuid (euid) != 0)
++    {
++      if (verbose_p)
++        perror("Error pam could not revert euid to user running as euid root,"
++               " locking may not work now\n");
++    }
++
++  if (verbose_p)
++    fprintf (stderr,
++             "<--end of pam_authenticate() returning ok_to_unblank = %d\n",
++             (int) ((pam_auth_status == PAM_SUCCESS) ? True : False));
++
++  if (si->pw_data->passwd_string)
++    {
++      memset(si->pw_data->passwd_string, 0,
++             strlen(si->pw_data->passwd_string));
++      free (si->pw_data->passwd_string);
++      si->pw_data->passwd_string = NULL;
++    }
++
++  if (pam_auth_status == PAM_SUCCESS)
+     si->unlock_state = ul_success;	     /* yay */
+   else if (si->unlock_state == ul_cancel ||
+            si->unlock_state == ul_time)
[email protected]@ -355,6 +496,13 @@ pam_priv_init (int argc, char **argv, Bool verbose_p)
+   const char file2[] = "/etc/pam.conf";
+   struct stat st;
+ 
++#ifdef __sun
++  if (! verbose_p)      /* SUN addition: only print warnings in verbose mode */
++    {                   /* since they are rarely useful and mostly just      */
++      return True;      /* cause confusion when users see them.		     */
++    }
++#endif
++
+ # ifndef S_ISDIR
+ #  define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+ # endif
[email protected]@ -381,6 +529,8 @@ pam_priv_init (int argc, char **argv, Bool verbose_p)
+                 break;
+               }
+           fclose (f);
++
++#ifndef __sun  /* disable the misleading message */
+           if (!ok)
+             {
+               fprintf (stderr,
[email protected]@ -388,9 +538,11 @@ pam_priv_init (int argc, char **argv, Bool verbose_p)
+                   "%s: password authentication via PAM is unlikely to work.\n",
+                        blurb(), file2, PAM_SERVICE_NAME, blurb());
+             }
++#endif
+         }
+       /* else warn about file2 existing but being unreadable? */
+     }
++#ifndef __sun  /* disable the misleading message */
+   else
+     {
+       fprintf (stderr,
[email protected]@ -398,15 +550,19 @@ pam_priv_init (int argc, char **argv, Bool verbose_p)
+                "%s: password authentication via PAM is unlikely to work.\n",
+                blurb(), file2, file, blurb());
+     }
++#endif
+ 
+   /* Return true anyway, just in case. */
+   return True;
+ }
+ 
+ 
+-static int
++int
+ pam_conversation (int nmsgs,
+-		  const struct pam_message **msg,
++#ifndef __sun
++                  const
++#endif
++		  struct pam_message **msg,
+ 		  struct pam_response **resp,
+ 		  void *vsaver_info)
+ {
+diff --git a/driver/passwd.c b/driver/passwd.c
+index ac5a3f0..0618642 100644
+--- a/driver/passwd.c
++++ b/driver/passwd.c
[email protected]@ -37,6 +37,7 @@
+ 
+ #include <X11/Intrinsic.h>
+ 
++#include "dialog-data.h"
+ #include "xscreensaver.h"
+ #include "auth.h"
+ 
+diff --git a/driver/setuid.c b/driver/setuid.c
+index 3ac78e4..a17194a 100644
+--- a/driver/setuid.c
++++ b/driver/setuid.c
[email protected]@ -145,7 +145,10 @@ set_ids_by_number (uid_t uid, gid_t gid, char **message_ret)
+     gid_errno = errno ? errno : -1;
+ 
+   errno = 0;
+-  if (setuid (uid) != 0)
++/*mali  if (setuid (uid) != 0)**we need root privs back at pam_authenticate
++  this is causing to loose root priv for good, not good **/
++
++  if (seteuid (uid) != 0)
+     uid_errno = errno ? errno : -1;
+ 
+   if (uid_errno == 0 && gid_errno == 0 && sgs_errno == 0)
+diff --git a/driver/subprocs.c b/driver/subprocs.c
+index 9414df1..a244f36 100644
+--- a/driver/subprocs.c
++++ b/driver/subprocs.c
[email protected]@ -243,7 +243,11 @@ show_job_list (void)
+ 
+ static void clean_job_list (void);
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++struct screenhack_job *
++#else
+ static struct screenhack_job *
++#endif
+ make_job (pid_t pid, int screen, const char *cmd)
+ {
+   struct screenhack_job *job = (struct screenhack_job *) malloc (sizeof(*job));
[email protected]@ -413,7 +417,11 @@ unblock_sigchld (void)
+   block_sigchld_handler--;
+ }
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++int
++#else
+ static int
++#endif
+ kill_job (saver_info *si, pid_t pid, int signal)
+ {
+   saver_preferences *p = &si->prefs;
[email protected]@ -598,9 +606,14 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status)
+ 	 mention them) if we've just killed the subprocess.  But mention them
+ 	 if they happen on their own.
+        */
+-      if (!job ||
+-	  (exit_status != 0 &&
+-	   (p->verbose_p || job->status != job_killed)))
++
++      if ((!job
++#ifdef HAVE_XSCREENSAVER_LOCK
++	   && kid != si->passwd_pid
++#endif /* HAVE_XSCREENSAVER_LOCK */
++	      ) ||
++	   (exit_status != 0 &&
++	    (p->verbose_p || (job && job->status != job_killed))))
+         {
+           /* Don't call fprintf() from signal handlers, as it might malloc.
+ 	  fprintf (stderr,
[email protected]@ -640,8 +653,12 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status)
+   else if (WIFSIGNALED (wait_status))
+     {
+       if (p->verbose_p ||
+-	  !job ||
+-	  job->status != job_killed ||
++	  (!job
++#ifdef HAVE_XSCREENSAVER_LOCK
++	   && kid != si->passwd_pid
++#endif /* HAVE_XSCREENSAVER_LOCK */
++		  ) ||
++	  (job && job->status != job_killed) ||
+ 	  WTERMSIG (wait_status) != SIGTERM)
+         {
+           /* Don't call fprintf() from signal handlers, as it might malloc.
[email protected]@ -709,12 +726,20 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status)
+   /* Clear out the pid so that screenhack_running_p() knows it's dead.
+    */
+   if (!job || job->status == job_dead)
++    {
+     for (i = 0; i < si->nscreens; i++)
+       {
+ 	saver_screen_info *ssi = &si->screens[i];
+ 	if (kid == ssi->pid)
+ 	  ssi->pid = 0;
+       }
++#ifdef HAVE_XSCREENSAVER_LOCK
++      if (kid == si->passwd_pid)
++	{
++	  si->passwd_pid = 0;
++	}
++#endif
++    }
+ }
+ 
+ #else  /* VMS */
+diff --git a/driver/timers.c b/driver/timers.c
+index 81c8adb..9afc752 100644
+--- a/driver/timers.c
++++ b/driver/timers.c
[email protected]@ -47,6 +47,8 @@
+ #endif /* HAVE_RANDR */
+ 
+ #include "xscreensaver.h"
++#include "types.h"
++#include "dialog-data.h"
+ 
+ #undef ABS
+ #define ABS(x)((x)<0?-(x):(x))
[email protected]@ -60,6 +62,11 @@ static Bool proc_interrupts_activity_p (saver_info *si);
+ #endif /* HAVE_PROC_INTERRUPTS */
+ 
+ static void check_for_clock_skew (saver_info *si);
++#ifdef HAVE_XSCREENSAVER_LOCK
++static void watchdog_timer (XtPointer closure, XtIntervalId *id);
++extern Bool g_passwd_dialog_created;
++extern Bool ok_to_unblank;
++#endif
+ 
+ 
+ void
[email protected]@ -257,7 +264,11 @@ cycle_timer (XtPointer closure, XtIntervalId *id)
+        crash.  So, restart the thing once an hour. */
+     how_long = 1000 * 60 * 60;
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++  if (si->external_passwd)
++#else
+   if (si->dbox_up_p)
++#endif
+     {
+       if (p->verbose_p)
+ 	fprintf (stderr, "%s: dialog box up; delaying hack change.\n",
[email protected]@ -310,7 +321,28 @@ activate_lock_timer (XtPointer closure, XtIntervalId *id)
+ 
+   if (p->verbose_p)
+     fprintf (stderr, "%s: timed out; activating lock.\n", blurb());
+-  set_locked_p (si, True);
++
++  if (si->locked_p)
++    {
++      if (p->verbose_p)
++        fprintf (stderr,
++          "-->activate_lock_timer returning because screen already locked\n");
++      return;
++    }
++
++  /* Make sure screen is blanked before posting dialog box */
++  if (si->screen_blanked_p)
++    {
++      set_locked_p (si, True);
++      ok_to_unblank = unlock_p (si);
++      if (ok_to_unblank == True)
++        {
++          set_locked_p(si,False);
++          unblank_screen(si);
++        }
++    }
++  else /* blanking of screen failed reset lock flag */
++    set_locked_p (si, False);
+ }
+ 
+ 
[email protected]@ -616,14 +648,30 @@ dispatch_event (saver_info *si, XEvent *event)
+ }
+ 
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++void /* called from lock.c */
++#else
+ static void
++#endif
+ swallow_unlock_typeahead_events (saver_info *si, XEvent *e)
+ {
+   XEvent event;
+   char buf [100];
+   int i = 0;
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++  if (!si->typeahead_events)
++    {
++      /* Allocate enough space for 10 keys to be queued - if we get more
++         than that before the dialog is ready, it's most likely the user
++         left something sitting on the keyboard, and won't want them. */
++      si->typeahead_events = calloc(10, sizeof(XKeyEvent));
++      if (si->typeahead_events == NULL)
++        return;
++    }
++#else
+   memset (buf, 0, sizeof(buf));
++#endif
+ 
+   event = *e;
+ 
[email protected]@ -636,10 +684,12 @@ swallow_unlock_typeahead_events (saver_info *si, XEvent *e)
+           if (size != 1) continue;
+           switch (*s)
+             {
++#ifndef HAVE_XSCREENSAVER_LOCK /* Let these be queued with the rest */
+             case '\010': case '\177':			/* Backspace */
+               if (i > 0) i--;
+               break;
+             case '\025': case '\030':			/* Erase line */
++#endif
+             case '\012': case '\015':			/* Enter */
+             case '\033':				/* ESC */
+               i = 0;
[email protected]@ -649,7 +699,17 @@ swallow_unlock_typeahead_events (saver_info *si, XEvent *e)
+                 break;  /* ignore space at beginning of line */
+               /* else, fall through */
+             default:
++#ifdef HAVE_XSCREENSAVER_LOCK
++              /* Queue events to replay once dialog is ready */
++              if (si->num_typeahead_events < 10)
++                memcpy (&si->typeahead_events[si->num_typeahead_events++],
++                        &event, sizeof(XKeyEvent));
++              else
++                XBell (si->dpy, 0);
++              i = 1; /* so that spaces are accepted after the beginning */
++#else
+               buf [i++] = *s;
++#endif
+               break;
+             }
+         }
[email protected]@ -657,6 +717,7 @@ swallow_unlock_typeahead_events (saver_info *si, XEvent *e)
+     } while (i < sizeof(buf)-1 &&
+              XCheckMaskEvent (si->dpy, KeyPressMask, &event));
+ 
++#ifndef HAVE_XSCREENSAVER_LOCK
+   buf[i] = 0;
+ 
+   if (si->unlock_typeahead)
[email protected]@ -671,6 +732,7 @@ swallow_unlock_typeahead_events (saver_info *si, XEvent *e)
+     si->unlock_typeahead = 0;
+ 
+   memset (buf, 0, sizeof(buf));
++#endif /* HAVE_XSCREENSAVER_LOCK */
+ }
+ 
+ 
[email protected]@ -854,6 +916,7 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
+ 	if (handle_clientmessage (si, &event.x_event, until_idle_p))
+           {
+             why = "ClientMessage";
++            si->emergency_lock_p = True;
+             goto DONE;
+           }
+ 	break;
[email protected]@ -868,6 +931,47 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
+ 	  }
+ 	break;
+ 
++      case VisibilityNotify:
++      {
++        int k;
++
++        if (p->debug_p)
++          {
++            fprintf (stderr,
++                     "************************************\n"
++                     "-->sleep_until_idle() event:VisibilityNotify\n"
++                     "\t Window of VisibilityNotify:%x\n"
++                     "\t until_idle_p=%d g_passwd_dialog_created=%d\n",
++                     event.x_event.xvisibility.window,
++                     until_idle_p, g_passwd_dialog_created);
++            fflush(stderr);
++          }
++
++        /* Don't raise root window when passwd dialog wants to come up */
++        if (g_passwd_dialog_created == 0 && !until_idle_p)
++          {
++            if (event.x_event.xvisibility.state != VisibilityUnobscured)
++              {
++                for (k = 0; k < si->nscreens; k++)
++                  {
++                    saver_screen_info *ssi = &si->screens[k];
++                    XClearWindow (si->dpy, ssi->screensaver_window);
++                    clear_stderr (ssi);
++                    XMapRaised (si->dpy, ssi->screensaver_window);
++                  }
++                if (p->debug_p)
++                  {
++                    fprintf (stderr,
++                             "A window is trying to popup.\n"
++                             "Raising saver root Window.\n"
++                             "************************************\n");
++                    fflush(stderr);
++                  }
++              }
++          }
++        break;
++      }
++
+       case KeyPress:
+       case ButtonPress:
+       /* Ignore release events so that hitting ESC at the password dialog
[email protected]@ -1565,7 +1669,11 @@ watchdog_timer (XtPointer closure, XtIntervalId *id)
+     {
+       Bool running_p = screenhack_running_p (si);
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++      if (si->external_passwd)
++#else
+       if (si->dbox_up_p)
++#endif
+         {
+           if (si->prefs.debug_p)
+             fprintf (stderr, "%s: dialog box is up: not raising screen.\n",
+diff --git a/driver/types.h b/driver/types.h
+index f1630b0..c77ee3f 100644
+--- a/driver/types.h
++++ b/driver/types.h
[email protected]@ -275,12 +275,30 @@ struct saver_info {
+   int unlock_failures;		/* Counts failed login attempts while the
+ 				   screen is locked. */
+   time_t unlock_failure_time;	/* Time of first failed login attempt. */
++#ifdef HAVE_XSCREENSAVER_LOCK
++  Window *raise_wins;		/* List of windows to raise above the	*/
++  int num_raise_wins;		/*  virtual root/hack display, such as	*/
++  int max_raise_wins;		/*  accessibility helpers		*/
++
++  Window *override_wins;        /* Windows we had to unset the          */
++  int num_override_wins;        /*  override_redirect attribute on and  */
++  int max_override_wins;        /*  need to restore it on after unlock. */
++
++
++  pid_t passwd_pid;             /* The pid of the password dialog child if we
++                                   are running an external process for it. */
++  Bool external_passwd;
++
++  XKeyEvent *typeahead_events;	/* Like unlock_typeahead, but as raw events */
++  int num_typeahead_events;
++#else
+ 
+   char *unlock_typeahead;	/* If the screen is locked, and the user types
+                                    a character, we assume that it is the first
+                                    character of the password.  It's stored here
+                                    for the password dialog to use to populate
+                                    itself. */
++#endif /* HAVE_XSCREENSAVER_LOCK */
+ 
+   char *user;			/* The user whose session is locked. */
+   char *cached_passwd;		/* Cached password, used to avoid multiple
+diff --git a/driver/windows.c b/driver/windows.c
+index 6acaddb..51e4c6a 100644
+--- a/driver/windows.c
++++ b/driver/windows.c
[email protected]@ -1082,8 +1082,12 @@ safe_XConfigureWindow (Display *dpy, Window window,
+   return (!error_handler_hit_p);
+ }
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++Bool
++#else
+ /* This might not be necessary, but just in case. */
+ static Bool
++#endif
+ safe_XDestroyWindow (Display *dpy, Window window)
+ {
+   XErrorHandler old_handler;
[email protected]@ -1097,6 +1101,14 @@ safe_XDestroyWindow (Display *dpy, Window window)
+   XSetErrorHandler (old_handler);
+   XSync (dpy, False);
+ 
++  /* clear any queued VisibilityNotify events so we don't cause XErrors
++     later when we try to process them and find the windowid is invalid */
++  XEvent event;
++  while (XCheckWindowEvent(dpy, window, VisibilityChangeMask, &event))
++    {
++      /* discard event */ ;
++    }
++
+   return (!error_handler_hit_p);
+ }
+ 
[email protected]@ -1211,6 +1223,7 @@ initialize_screensaver_window_1 (saver_screen_info *ssi)
+    */
+   attrs.event_mask = (KeyPressMask | KeyReleaseMask |
+ 		      ButtonPressMask | ButtonReleaseMask |
++		      VisibilityChangeMask |
+ 		      PointerMotionMask);
+ 
+   attrs.backing_store = NotUseful;
[email protected]@ -1482,6 +1495,9 @@ raise_window (saver_info *si,
+   saver_preferences *p = &si->prefs;
+   int i;
+ 
++  if (p->verbose_p)
++      fprintf(stderr,"-->raise_window()\n");
++
+   if (si->demoing_p)
+     inhibit_fade = True;
+ 
[email protected]@ -1696,6 +1712,9 @@ unblank_screen (saver_info *si)
+   Bool unfade_p = (si->fading_possible_p && p->unfade_p);
+   int i;
+ 
++  if (p->verbose_p)
++      fprintf(stderr,"-->unblank_screen()\n");
++
+   monitor_power_on (si, True);
+   reset_watchdog_timer (si, False);
+ 
[email protected]@ -1984,7 +2003,7 @@ select_visual (saver_screen_info *ssi, const char *visual_name)
+       maybe_transfer_grabs (ssi, old_w, ssi->screensaver_window, ssi->number);
+ 
+       /* Now we can destroy the old window without horking our grabs. */
+-      XDestroyWindow (si->dpy, old_w);
++      safe_XDestroyWindow (si->dpy, old_w);
+ 
+       if (p->verbose_p)
+ 	fprintf (stderr, "%s: %d: destroyed old saver window 0x%lx.\n",
+diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
+index 06f5c13..33d357a 100644
+--- a/driver/xscreensaver.c
++++ b/driver/xscreensaver.c
[email protected]@ -164,6 +164,8 @@
+ #include <X11/StringDefs.h>
+ #include <X11/Shell.h>
+ #include <X11/Xos.h>
++#include <gconf/gconf-client.h>
++#include <glib.h>
+ #include <time.h>
+ #include <sys/time.h>
+ #include <netdb.h>	/* for gethostbyname() */
[email protected]@ -225,6 +227,7 @@
+ #endif /* HAVE_RANDR */
+ 
+ 
++#include "dialog-data.h"
+ #include "xscreensaver.h"
+ #include "version.h"
+ #include "yarandom.h"
[email protected]@ -236,11 +239,28 @@
+ 
+ saver_info *global_si_kludge = 0;	/* I hate C so much... */
+ 
++/* Globals */
++Bool ok_to_unblank = False;
++
++#ifdef HAVE_XSCREENSAVER_LOCK
++/* Global storage for gtk passwd lock dialog
++ * we assign this to si->pw_data and this is needed
++ * to set user/passwd labels on gtk lock dialog by
++ * pam conv function.
++ */
++passwd_dialog_data mygtkpwd;
++passwd_dialog_data *ptr_mygtkpwd = &mygtkpwd;
++#endif
++
+ char *progname = 0;
+ char *progclass = 0;
+ XrmDatabase db = 0;
+ 
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++Atom XA_UNLOCK_RATIO;
++#endif
++
+ 
+ static XrmOptionDescRec options [] = {
+ 
[email protected]@ -670,6 +690,9 @@ connect_to_server (saver_info *si, int *argc, char **argv)
+ 	{ &XA_ESETROOT_PMAP_ID, "ESETROOT_PMAP_ID" },
+ 	{ &XA_XROOTPMAP_ID, "_XROOTPMAP_ID" },
+ 	{ &XA_NET_WM_USER_TIME, "_NET_WM_USER_TIME" },
++#ifdef HAVE_XSCREENSAVER_LOCK
++	{ &XA_UNLOCK_RATIO, "UNLOCK_RATIO" },
++#endif
+ 	{ NULL, NULL } /* Must be last to terminate list */
+       };
+     const struct atom_request *atom_lists[3] = { NULL, NULL, NULL };
[email protected]@ -1164,8 +1187,36 @@ static void
+ main_loop (saver_info *si)
+ {
+   saver_preferences *p = &si->prefs;
+-  Bool ok_to_unblank;
++  /* Bool ok_to_unblank; made this a global flag, gets set in timers.c */
+   int i;
++  const char *modulesptr = NULL;
++
++/*
++** CR4784055(P1)locked-screen dialog is inaccessible to Gnopernicus
++** voice for each type-in char in the password field of
++** pop-up dialog
++*/
++
++  /* BUG #6573182
++  ** g_type_init should be done before calling gconf_client routines
++  ** so that xscreensaver does not dump core if gconf daemon is not running.
++  */
++  g_type_init ();
++
++  /*
++  ** 6395649 at-spi-registryd starts when screen is locked even
++  ** when accessible device support is off(SR)
++  ** per AT core gp suggestion
++  ** GTK_MODULES is set only if at support is enabled
++  */
++
++  if (gconf_client_get_bool(gconf_client_get_default(),
++			    "/desktop/gnome/interface/accessibility", NULL))
++    {
++      modulesptr = getenv ("GTK_MODULES");
++      if (!modulesptr || modulesptr [0] == '\0')
++	putenv ("GTK_MODULES=gail:atk-bridge");
++    }
+ 
+   while (1)
+     {
[email protected]@ -1196,6 +1247,17 @@ main_loop (saver_info *si)
+             fprintf (stderr, "%s: idle with blanking disabled at %s.\n",
+                      blurb(), timestring());
+ 
++          /* 6221109 Changing mode from disable to anything else,
++             doesn't lock screen.
++
++             This is Disable Screen Saver mode, in this mode we dont lock
++             screen, but si->locked_p is already set to True, since someone
++             tried to lock screen, reset it to False, else when we change
++             mode from disable and try to lock screen, xscreensaver thinks
++             screen is already locked and doesnt lock screen anymore.
++           */
++          set_locked_p (si, False);
++
+           /* Go around the loop and wait for the next bout of idleness,
+              or for the init file to change, or for a remote command to
+              come in, or something.
[email protected]@ -1267,6 +1329,7 @@ main_loop (saver_info *si)
+                 set_locked_p (si, False);
+ 
+               schedule_wakeup_event (si, retry, p->debug_p);
++              set_locked_p(si, False);
+               continue;
+             }
+         }
[email protected]@ -1329,7 +1392,17 @@ main_loop (saver_info *si)
+             p->lock_p &&                /* and locking is enabled */
+             !si->locking_disabled_p &&  /* and locking is possible */
+             lock_timeout == 0)          /* and locking is not timer-deferred */
+-          set_locked_p (si, True);      /* then lock right now. */
++          {
++           if (p->debug_p)
++             fprintf(stderr, "going to lock screen B\n");
++           set_locked_p (si, True);      /* then lock right now. */
++           ok_to_unblank = unlock_p(si);
++           if (ok_to_unblank == True)
++             {
++               set_locked_p (si, False);
++               goto DONE;
++             }
++          }
+ 
+         /* locked_p might be true already because of the above, or because of
+            the LOCK ClientMessage.  But if not, and if we're supposed to lock
[email protected]@ -1344,10 +1417,7 @@ main_loop (saver_info *si)
+       }
+ #endif /* !NO_LOCKING */
+ 
+-
+-      ok_to_unblank = True;
+       do {
+-
+         check_for_leaks ("blanked A");
+ 	sleep_until_idle (si, False);		/* until not idle */
+         check_for_leaks ("blanked B");
[email protected]@ -1357,6 +1427,13 @@ main_loop (saver_info *si)
+ #ifndef NO_LOCKING
+         /* Maybe unlock the screen.
+          */
++        if (si->demoing_p) goto DONE; /* in demoing mode and user wants out
++                                         unblank screen */
++
++        /* This is when blank timeout has happened but lock timeout hasnt
++           and user gets active.  Simply get him out of the blank screen. */
++        if (si->screen_blanked_p && !si->locked_p) goto DONE;
++
+ 	if (si->locked_p)
+ 	  {
+ 	    saver_screen_info *ssi = si->default_screen;
[email protected]@ -1368,7 +1445,20 @@ main_loop (saver_info *si)
+               suspend_screenhack (&si->screens[i], True);	  /* suspend */
+ 	    XUndefineCursor (si->dpy, ssi->screensaver_window);
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++            /* Prevents lock dialog posting on non blanked screen */
++            if (!si->screen_blanked_p)  /* locked_p is true, so blank now */
++              blank_screen (si);
++            if (si->screen_blanked_p)   /* if blanking successful, call PAM */
++              {
++                set_locked_p (si, True);
++                ok_to_unblank = unlock_p(si);
++              }
++            else /* blanking failed, probably couldn't grab keyboard/mouse */
++              set_locked_p (si, False);
++#else
+ 	    ok_to_unblank = unlock_p (si);
++#endif
+ 
+ 	    si->dbox_up_p = False;
+ 	    XDefineCursor (si->dpy, ssi->screensaver_window, ssi->cursor);
[email protected]@ -1393,6 +1483,7 @@ main_loop (saver_info *si)
+ 
+ 	} while (!ok_to_unblank);
+ 
++DONE:
+ 
+       if (p->verbose_p)
+ 	fprintf (stderr, "%s: unblanking screen at %s.\n",
[email protected]@ -1477,7 +1568,19 @@ main (int argc, char **argv)
+   textdomain (GETTEXT_PACKAGE);
+ #endif /* ENABLE_NLS */
+ 
++#if defined(ENABLE_NLS) && defined(HAVE_XSCREENSAVER_LOCK)
++  /* Gtk unlock dialog needs to be sent UTF-8 text to display */
++  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
++#endif
++
+   memset(si, 0, sizeof(*si));
++
++#ifdef HAVE_XSCREENSAVER_LOCK
++/* Initialize and point si to pw_data i.e. the lock dialog struct */
++  memset(ptr_mygtkpwd, 0, sizeof(*ptr_mygtkpwd));
++  si->pw_data = ptr_mygtkpwd;
++#endif
++
+   global_si_kludge = si;	/* I hate C so much... */
+ 
+   fix_fds();
[email protected]@ -1487,7 +1590,9 @@ main (int argc, char **argv)
+ 
+   save_argv (argc, argv);
+   set_version_string (si, &argc, argv);
++#ifndef HAVE_XSCREENSAVER_LOCK /* moved below for external lock */
+   privileged_initialization (si, &argc, argv);
++#endif
+   hack_environment (si);
+ 
+   spasswd = getpwuid(getuid());
[email protected]@ -1510,6 +1615,10 @@ main (int argc, char **argv)
+   print_banner (si);
+ 
+   load_init_file(si->dpy, p); /* must be before initialize_per_screen_info() */
++#ifdef HAVE_XSCREENSAVER_LOCK
++  privileged_initialization (si, &argc, argv);
++#endif
++
+   blurb_timestamp_p = p->timestamp_p;  /* kludge */
+   initialize_per_screen_info (si, shell); /* also sets si->fading_possible_p */
+ 
[email protected]@ -1762,8 +1871,12 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
+   Atom type = 0;
+   Window window = event->xclient.window;
+ 
++  if (p->verbose_p)
++     fprintf(stderr, "handle_clientmessage\n");
++
+   /* Preferences might affect our handling of client messages. */
+   maybe_reload_init_file (si);
++  XSync (si->dpy, False);
+ 
+   if (event->xclient.message_type != XA_SCREENSAVER ||
+       event->xclient.format != 32)
[email protected]@ -2055,10 +2168,14 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
+ 	  sprintf (buf, "LOCK ClientMessage received; %s", response);
+ 	  clientmessage_response (si, window, False, buf, response);
+ 
++	  if (p->verbose_p)
++	    fprintf(stderr, "going to lock screen A\n");
++
+           /* Note that this leaves things in a slightly inconsistent state:
+              we are blanked but not locked.  And blanking might actually
+              fail if we can't get the grab. */
+ 	  set_locked_p (si, True);
++	  si->emergency_lock_p = True;
+ 
+            /* Have to set the time or xscreensaver-command doesn't
+               report the LOCK state change. */
[email protected]@ -2067,6 +2184,9 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
+ 	  si->selection_mode = 0;
+ 	  si->demoing_p = False;
+ 
++	  return True; /* dont set lock_id to 0,
++                          causes to go in lock in main_loop above */
++
+ 	  if (si->lock_id)	/* we're doing it now, so lose the timeout */
+ 	    {
+ 	      XtRemoveTimeOut (si->lock_id);
+diff --git a/driver/xscreensaver.h b/driver/xscreensaver.h
+index 064e9c4..a52ba63 100644
+--- a/driver/xscreensaver.h
++++ b/driver/xscreensaver.h
[email protected]@ -164,6 +164,12 @@ extern Bool select_visual (saver_screen_info *ssi, const char *visual_name);
+ extern void store_saver_status (saver_info *si);
+ extern const char *signal_name (int signal);
+ 
++#ifdef HAVE_XSCREENSAVER_LOCK
++extern int kill_job (saver_info *si, pid_t pid, int signal);
++extern struct screenhack_job *make_job (pid_t pid, int screen,
++                                        const char *cmd);
++#endif
++
+ /* =======================================================================
+    subprocs diagnostics
+    ======================================================================= */
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0006-allow-root.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,208 @@
+From 53a079ae5ba815381fd94cace1a56cd2841e09ed Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 20:56:50 -0800
+Subject: [PATCH] allow root
+
+Fix for: Bug 15155994 - SUNBT4849641 xscreensaver won't run as root
+
+Let root lock the screen, but don't launch the hacks for root.
+
+Rejected by upstream because upstream author argues instead that users should
+not login as root, which is correct, but not something we can force all of
+our customers to stop doing.
+
+See http://www.jwz.org/xscreensaver/faq.html#root-lock for his side.
+---
+ driver/demo-Gtk.c     | 18 ++++++++++++++++++
+ driver/exec.c         |  2 ++
+ driver/setuid.c       | 12 ++++++++++++
+ driver/subprocs.c     |  3 +++
+ driver/timers.c       |  2 +-
+ driver/xscreensaver.c |  7 ++++---
+ 6 files changed, 40 insertions(+), 4 deletions(-)
+
+diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
+index ece3c44..d4cc4a5 100644
+--- a/driver/demo-Gtk.c
++++ b/driver/demo-Gtk.c
[email protected]@ -713,6 +713,14 @@ run_hack (state *s, int list_elt, Bool report_errors_p)
+   char *err = 0;
+   int status;
+ 
++  if (getuid () == 0)
++    {
++      char buf [255];
++      strlcpy (buf, _("Can not run hacks if logged in as root!"), sizeof(buf));
++      warning_dialog (s->toplevel_widget, buf, False, 100);
++      return;
++    }
++
+   if (list_elt < 0) return;
+   hack_number = s->list_elt_to_hack_number[list_elt];
+ 
[email protected]@ -5173,6 +5181,15 @@ main (int argc, char **argv)
+     GtkMenu *menu = GTK_MENU (gtk_option_menu_get_menu (opt));
+     GList *kids = gtk_container_children (GTK_CONTAINER (menu));
+     int i;
++
++    if (getuid () == 0)
++      {
++        /* If logged in as root disable menu so user can't activate a hack. */
++        gtk_widget_set_sensitive (GTK_WIDGET (opt), False);
++        gtk_widget_set_sensitive (GTK_WIDGET (menu), False);
++      }
++    else
++    {
+     for (i = 0; kids; kids = kids->next, i++)
+       {
+         gtk_signal_connect (GTK_OBJECT (kids->data), "activate",
[email protected]@ -5186,6 +5203,7 @@ main (int argc, char **argv)
+             mode_menu_order[i] == RANDOM_HACKS_SAME)
+           gtk_widget_hide (GTK_WIDGET (kids->data));
+       }
++    }
+ 
+     if (s->nscreens <= 1)   /* recompute option-menu size */
+       {
+diff --git a/driver/exec.c b/driver/exec.c
+index 38ca88a..b68089e 100644
+--- a/driver/exec.c
++++ b/driver/exec.c
[email protected]@ -186,6 +186,7 @@ exec_command (const char *shell, const char *command, int nice_level)
+   hairy_p = !!strpbrk (command, "*?$&!<>[];`'\\\"=");
+   /* note: = is in the above because of the sh syntax "FOO=bar cmd". */
+ 
++#ifdef DONT_ALLOW_ROOT_LOGIN
+   if (getuid() == (uid_t) 0 || geteuid() == (uid_t) 0)
+     {
+       /* If you're thinking of commenting this out, think again.
[email protected]@ -196,6 +197,7 @@ exec_command (const char *shell, const char *command, int nice_level)
+                blurb());
+       exit (-1);
+     }
++#endif /*DONT_ALLOW_ROOT_LOGIN*/
+ 
+   if (hairy_p)
+     /* If it contains any shell metacharacters, do it the hard way,
+diff --git a/driver/setuid.c b/driver/setuid.c
+index a17194a..e3aa78d 100644
+--- a/driver/setuid.c
++++ b/driver/setuid.c
[email protected]@ -121,6 +121,10 @@ set_ids_by_number (uid_t uid, gid_t gid, char **message_ret)
+   struct passwd *p = getpwuid (uid);
+   struct group  *g = getgrgid (gid);
+ 
++  /* if we are logged in as root i.e. uid==0 then dont do anything*/
++  if (getuid () == (uid_t) 0)
++   return 0;
++
+   if (message_ret)
+     *message_ret = 0;
+ 
[email protected]@ -278,11 +282,13 @@ hack_uid (saver_info *si)
+          of the xscreensaver manual titled "LOCKING AND ROOT LOGINS",
+          and "USING XDM".
+    */
++#ifdef DONT_ALLOW_ROOT_LOGIN
+   if (getuid() == (uid_t) 0)
+     {
+       si->locking_disabled_p = True;
+       si->nolock_reason = "running as root";
+     }
++#endif /*DONT_ALLOW_ROOT_LOGIN*/
+ 
+ 
+   /* If we're running as root, switch to a safer user.  This is above and
[email protected]@ -297,6 +303,8 @@ hack_uid (saver_info *si)
+          of the xscreensaver manual titled "LOCKING AND ROOT LOGINS", 
+          and "USING XDM".
+    */
++/* We are letting root login to fix a P1 bug, i.e. root should lock screen*/
++#ifdef DONT_ALLOW_ROOT_LOGIN
+   if (getuid() == (uid_t) 0)
+     {
+       struct passwd *p;
[email protected]@ -315,6 +323,7 @@ hack_uid (saver_info *si)
+       if (set_ids_by_number (p->pw_uid, p->pw_gid, &si->uid_message) != 0)
+ 	saver_exit (si, -1, 0);
+     }
++#endif /*DONT_ALLOW_ROOT_LOGIN*/
+ 
+ 
+   /* If there's anything even remotely funny looking about the passwd struct,
[email protected]@ -357,7 +366,10 @@ hack_uid (saver_info *si)
+ 		 (p && p->pw_name && *p->pw_name
+ 		  ? p->pw_name : "<unknown>"));
+ 	si->nolock_reason = buf;
++
++#ifdef DONT_ALLOW_ROOT_LOGIN
+ 	si->locking_disabled_p = True;
++#endif
+ 	si->dangerous_uid_p = True;
+       }
+   }
+diff --git a/driver/subprocs.c b/driver/subprocs.c
+index a244f36..c975813 100644
+--- a/driver/subprocs.c
++++ b/driver/subprocs.c
[email protected]@ -947,6 +947,9 @@ spawn_screenhack (saver_screen_info *ssi)
+   saver_preferences *p = &si->prefs;
+   char* complete_hack_command;
+ 
++  if (getuid () == 0)
++    return;  /* Dont let hacks run if logged in as root*/
++
+   if (si->prefs.verbose_p)
+    fprintf(stderr, "--> spawn_screenhack()\n");
+ 
+diff --git a/driver/timers.c b/driver/timers.c
+index 9afc752..32728a0 100644
+--- a/driver/timers.c
++++ b/driver/timers.c
[email protected]@ -284,7 +284,7 @@ cycle_timer (XtPointer closure, XtIntervalId *id)
+ 
+       raise_window (si, True, True, False);
+ 
+-      if (!si->throttled_p)
++      if (!si->throttled_p && getuid () != 0)
+         for (i = 0; i < si->nscreens; i++)
+           spawn_screenhack (&si->screens[i]);
+       else
+diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
+index 33d357a..f357281 100644
+--- a/driver/xscreensaver.c
++++ b/driver/xscreensaver.c
[email protected]@ -487,6 +487,7 @@ startup_ehandler (String name, String type, String class,
+ 
+   describe_uids (si, stderr);
+ 
++#ifdef DONT_ALLOW_ROOT_LOGIN
+   if (si->orig_uid && !strncmp (si->orig_uid, "root/", 5))
+     {
+       fprintf (stderr, "\n"
[email protected]@ -500,11 +501,11 @@ startup_ehandler (String name, String type, String class,
+                blurb());
+     }
+   else
++#endif /*DONT_ALLOW_ROOT_LOGIN*/
+     {
+       fprintf (stderr, "\n"
+           "%s: Errors at startup are usually authorization problems.\n"
+-"              But you're not logging in as root (good!) so something\n"
+-"              else must be wrong.  Did you read the manual and the FAQ?\n",
++"              Did you read the manual and the FAQ?\n",
+            blurb());
+     }
+ 
[email protected]@ -1338,7 +1339,7 @@ main_loop (saver_info *si)
+         kill_screenhack (&si->screens[i]);
+ 
+       raise_window (si, True, True, False);
+-      if (si->throttled_p)
++      if (si->throttled_p || getuid () == 0)
+         fprintf (stderr, "%s: not launching hack (throttled.)\n", blurb());
+       else
+         for (i = 0; i < si->nscreens; i++)
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0007-passwdTimeout-pref.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,281 @@
+From 37f1a55c40ce9aaf136f1512068b04f6a5c36d48 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 22:02:23 -0800
+Subject: [PATCH] passwdTimeout pref
+
+Bug 15220000 SUNBT5077981 There should be an option to extend/disable lockout
+                          timer
+aka http://bugzilla.gnome.org/show_bug.cgi?id=147579
+
+Bug 15231258 SUNBT6176524 passwdTimeoutEnable for disabled user
+
+Upstream status unknown.
+---
+ driver/XScreenSaver.ad.in          |  1 +
+ driver/demo-Gtk.c                  | 13 +++++
+ driver/lock.c                      |  8 ++++
+ driver/prefs.c                     |  6 +++
+ driver/types.h                     |  2 +
+ driver/xscreensaver-demo.glade2.in | 98 +++++++++++++++++++++++++++++++++++++-
+ 6 files changed, 127 insertions(+), 1 deletion(-)
+
+diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in
+index 3e1ff8a..0a0ccf8 100644
+--- a/driver/XScreenSaver.ad.in
++++ b/driver/XScreenSaver.ad.in
[email protected]@ -33,6 +33,7 @@
+ *cycle:			0:10:00
+ *lockTimeout:		0:00:00
+ *passwdTimeout:		0:02:00
++*passwdTimeoutEnabled:	True
+ *dpmsEnabled:		True
+ *dpmsQuickoffEnabled:	False
+ *dpmsStandby:		0:10:00
+diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
+index d4cc4a5..3d86087 100644
+--- a/driver/demo-Gtk.c
++++ b/driver/demo-Gtk.c
[email protected]@ -1566,6 +1566,8 @@ flush_dialog_changes_and_save (state *s)
+ 
+   MINUTES  (&p2->timeout,         "timeout_spinbutton");
+   MINUTES  (&p2->cycle,           "cycle_spinbutton");
++  CHECKBOX (p2->unlock_timeout_p, "pwd_button");	/* bugid 5077981 */
++  MINUTES  (&p2->passwd_timeout,  "pwd_spinbutton");
+   CHECKBOX (p2->lock_p,           "lock_button");
+   MINUTES  (&p2->lock_timeout,    "lock_spinbutton");
+ 
[email protected]@ -1670,6 +1672,8 @@ flush_dialog_changes_and_save (state *s)
+   COPY(cycle,          "cycle");
+   COPY(lock_p,         "lock_p");
+   COPY(lock_timeout,   "lock_timeout");
++  COPY(unlock_timeout_p,"unlock_timeout_p");		/* bugid 5077981 */
++  COPY(passwd_timeout, "passwd_timeout");
+ 
+   COPY(dpms_enabled_p,  "dpms_enabled_p");
+   COPY(dpms_quickoff_p, "dpms_quickoff_enabled_p");
[email protected]@ -2802,6 +2806,9 @@ populate_prefs_page (state *s)
+   FMT_MINUTES ("timeout_spinbutton",      p->timeout);
+   FMT_MINUTES ("cycle_spinbutton",        p->cycle);
+   FMT_MINUTES ("lock_spinbutton",         p->lock_timeout);
++  /* bugid 5077981 */
++  FMT_MINUTES ("pwd_spinbutton",          p->passwd_timeout);
++
+   FMT_MINUTES ("dpms_standby_spinbutton", p->dpms_standby);
+   FMT_MINUTES ("dpms_suspend_spinbutton", p->dpms_suspend);
+   FMT_MINUTES ("dpms_off_spinbutton",     p->dpms_off);
[email protected]@ -2814,6 +2821,7 @@ populate_prefs_page (state *s)
+   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (name_to_widget (s,(NAME))),\
+                                 (ACTIVEP))
+ 
++  TOGGLE_ACTIVE ("pwd_button",	      p->unlock_timeout_p); /* bugid 5077981 */
+   TOGGLE_ACTIVE ("lock_button",       p->lock_p);
+ #if 0
+   TOGGLE_ACTIVE ("verbose_button",    p->verbose_p);
[email protected]@ -2919,6 +2927,10 @@ populate_prefs_page (state *s)
+ 
+     /* Blanking and Locking
+      */
++    /* bugid 5077081 */
++    SENSITIZE ("pwd_spinbutton", p->unlock_timeout_p);
++    SENSITIZE ("pwd_mlabel",     p->unlock_timeout_p);
++
+     SENSITIZE ("lock_button",     can_lock_p);
+     SENSITIZE ("lock_spinbutton", can_lock_p && p->lock_p);
+     SENSITIZE ("lock_mlabel",     can_lock_p && p->lock_p);
[email protected]@ -3093,6 +3105,7 @@ fix_text_entry_sizes (state *s)
+ # if 0   /* appears no longer necessary with Gtk 1.2.10 */
+   const char * const spinbuttons[] = {
+     "timeout_spinbutton", "cycle_spinbutton", "lock_spinbutton",
++    "pwd_spinbutton", /* bugid 5077981 */
+     "dpms_standby_spinbutton", "dpms_suspend_spinbutton",
+     "dpms_off_spinbutton",
+     "-fade_spinbutton" };
+diff --git a/driver/lock.c b/driver/lock.c
+index becf85b..08f0f98 100644
+--- a/driver/lock.c
++++ b/driver/lock.c
[email protected]@ -1651,6 +1651,10 @@ update_passwd_window (saver_info *si, const char *printed_passwd, float ratio)
+       event.xclient.data.l[1] = 0;
+       event.xclient.data.l[2] = 0;
+ 
++      /* CR 5077981: option to disable unlock timer */
++      if (! si->prefs.unlock_timeout_p)
++        event.xclient.data.l[1] = 1;
++
+       if (!safe_XSendEvent (si->dpy, si->passwd_dialog, False, 0L, &event))
+         fprintf (stderr, "%s: error sending ratio to lock dialog\n", blurb ());
+     }
[email protected]@ -2358,6 +2362,10 @@ passwd_animate_timer (XtPointer closure, XtIntervalId *id)
+ 
+   if (!pw) return;
+ 
++  /* CR 5077981: option to disable unlock timer */
++  if (! si->prefs.unlock_timeout_p)
++    return;
++
+ #ifdef HAVE_XSCREENSAVER_LOCK
+   /* We want to make sure dialog is up before we update countdown timer */
+   if (!si->passwd_dialog)
+diff --git a/driver/prefs.c b/driver/prefs.c
+index 55bac7b..52538a8 100644
+--- a/driver/prefs.c
++++ b/driver/prefs.c
[email protected]@ -252,6 +252,7 @@ static const char * const prefs[] = {
+   "lockVTs",			/* not saved */
+   "lockTimeout",
+   "passwdTimeout",
++  "passwdTimeoutEnabled",	/* bugid 5077981 */
+   "visualID",
+   "installColormap",
+   "verbose",
[email protected]@ -786,6 +787,9 @@ write_init_file (Display *dpy,
+       CHECK("lockVTs")		continue;  /* don't save, unused */
+       CHECK("lockTimeout")	type = pref_time, t = p->lock_timeout;
+       CHECK("passwdTimeout")	type = pref_time, t = p->passwd_timeout;
++
++/* bugid 5077981 */
++      CHECK("passwdTimeoutEnabled") type = pref_bool, b = p->unlock_timeout_p;
+       CHECK("visualID")		type = pref_str,  s =    visual_name;
+       CHECK("installColormap")	type = pref_bool, b = p->install_cmap_p;
+       CHECK("verbose")		type = pref_bool, b = p->verbose_p;
[email protected]@ -1071,6 +1075,8 @@ load_init_file (Display *dpy, saver_preferences *p)
+   p->lock_timeout    = 1000 * get_minutes_resource (dpy, "lockTimeout", "Time");
+   p->cycle           = 1000 * get_minutes_resource (dpy, "cycle", "Time");
+   p->passwd_timeout  = 1000 * get_seconds_resource (dpy, "passwdTimeout", "Time");
++  /* bugid 5077981 */
++  p->unlock_timeout_p = get_boolean_resource (dpy, "passwdTimeoutEnabled", "Boolean");
+   p->pointer_timeout = 1000 * get_seconds_resource (dpy, "pointerPollTime", "Time");
+   p->pointer_hysteresis = get_integer_resource (dpy, "pointerHysteresis","Integer");
+   p->notice_events_timeout = 1000*get_seconds_resource(dpy,
+diff --git a/driver/types.h b/driver/types.h
+index c77ee3f..b428f73 100644
+--- a/driver/types.h
++++ b/driver/types.h
[email protected]@ -97,6 +97,8 @@ struct saver_preferences {
+   Bool xsync_p;			/* whether XSynchronize has been called */
+ 
+   Bool lock_p;			/* whether to lock as well as save */
++  Bool unlock_timeout_p;	/* whether to timeout unlock dialog */
++                                /* bugid 5077981 */
+ 
+   Bool fade_p;			/* whether to fade to black, if possible */
+   Bool unfade_p;		/* whether to fade from black, if possible */
+diff --git a/driver/xscreensaver-demo.glade2.in b/driver/xscreensaver-demo.glade2.in
+index 40e47f6..a7a06a6 100644
+--- a/driver/xscreensaver-demo.glade2.in
++++ b/driver/xscreensaver-demo.glade2.in
[email protected]@ -165,7 +165,7 @@
+ 		  <child>
+ 		    <widget class="GtkTable" id="blanking_table">
+ 		      <property name="visible">True</property>
+-		      <property name="n_rows">3</property>
++		      <property name="n_rows">4</property>
+ 		      <property name="n_columns">4</property>
+ 		      <property name="homogeneous">False</property>
+ 		      <property name="row_spacing">2</property>
[email protected]@ -466,6 +466,102 @@
+ 			  <property name="y_options"></property>
+ 			</packing>
+ 		      </child>
++
++		      <child>
++			<widget class="GtkSpinButton" id="pwd_spinbutton">
++			  <property name="visible">True</property>
++			  <property name="tooltip" translatable="yes">How long the unlock dialog waits for input before disappearing.</property>
++			  <property name="can_focus">True</property>
++			  <property name="climb_rate">15</property>
++			  <property name="digits">0</property>
++			  <property name="numeric">True</property>
++			  <property name="update_policy">GTK_UPDATE_ALWAYS</property>
++			  <property name="snap_to_ticks">True</property>
++			  <property name="wrap">False</property>
++			  <property name="adjustment">0 0 720 1 15 15</property>
++			  <accessibility>
++			    <atkrelation target="pwd_button" type="controlled-by"/>
++			    <atkrelation target="pwd_button" type="labelled-by"/>
++			    <atkrelation target="pwd_mlabel" type="labelled-by"/>
++			  </accessibility>
++			  <signal name="activate" handler="pref_changed_cb"/>
++			  <signal name="focus_out_event" handler="pref_changed_event_cb"/>
++			  <signal name="value_changed" handler="pref_changed_cb"/>
++			</widget>
++			<packing>
++			  <property name="left_attach">2</property>
++			  <property name="right_attach">3</property>
++			  <property name="top_attach">3</property>
++			  <property name="bottom_attach">4</property>
++			  <property name="y_padding">10</property>
++			  <property name="x_options">fill</property>
++			  <property name="y_options"></property>
++			</packing>
++		      </child>
++
++		      <child>
++			<widget class="GtkEventBox" id="pwd_button_eventbox">
++			  <property name="visible">True</property>
++			  <property name="tooltip" translatable="yes">Whether the unlock dialog box should disappear after a timeout.</property>
++			  <property name="visible_window">True</property>
++			  <property name="above_child">False</property>
++
++			  <child>
++			    <widget class="GtkCheckButton" id="pwd_button">
++			      <property name="visible">True</property>
++			      <property name="can_focus">True</property>
++			      <property name="label" translatable="yes">Timeout _Unlock After</property>
++			      <property name="use_underline">True</property>
++			      <property name="relief">GTK_RELIEF_NORMAL</property>
++			      <property name="focus_on_click">True</property>
++			      <property name="active">False</property>
++			      <property name="inconsistent">False</property>
++			      <property name="draw_indicator">True</property>
++			      <accessibility>
++				<atkrelation target="pwd_spinbutton" type="controller-for"/>
++				<atkrelation target="pwd_spinbutton" type="label-for"/>
++				<atkrelation target="pwd_spinbutton" type="flows-to"/>
++			      </accessibility>
++			      <signal name="toggled" handler="pref_changed_cb"/>
++			    </widget>
++			  </child>
++			</widget>
++			<packing>
++			  <property name="left_attach">0</property>
++			  <property name="right_attach">2</property>
++			  <property name="top_attach">3</property>
++			  <property name="bottom_attach">4</property>
++			  <property name="x_options">fill</property>
++			  <property name="y_options">fill</property>
++			</packing>
++		      </child>
++
++		      <child>
++			<widget class="GtkLabel" id="pwd_mlabel">
++			  <property name="visible">True</property>
++			  <property name="label" translatable="yes">minutes</property>
++			  <property name="use_underline">False</property>
++			  <property name="use_markup">False</property>
++			  <property name="justify">GTK_JUSTIFY_LEFT</property>
++			  <property name="wrap">False</property>
++			  <property name="selectable">False</property>
++			  <property name="xalign">0</property>
++			  <property name="yalign">0.5</property>
++			  <property name="xpad">8</property>
++			  <property name="ypad">0</property>
++			  <accessibility>
++			    <atkrelation target="pwd_spinbutton" type="label-for"/>
++			    <atkrelation target="pwd_spinbutton" type="flows-from"/>
++			  </accessibility>
++			</widget>
++			<packing>
++			  <property name="left_attach">3</property>
++			  <property name="right_attach">4</property>
++			  <property name="top_attach">3</property>
++			  <property name="bottom_attach">4</property>
++			  <property name="y_options"></property>
++			</packing>
++		      </child>
+ 		    </widget>
+ 		    <packing>
+ 		      <property name="left_attach">0</property>
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0008-security-policy.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,354 @@
+From 65b6bdc8096ef4ac5b3bd41a0f2d38afe12c75ee Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 22:23:10 -0800
+Subject: [PATCH] security-policy
+
+Bug 15284497 SUNBT6317441 Allow admins to remove user-configurability from
+                          screensaver
+
+- Upstream rejected as "I will never implement that, because it's stupid and
+  unenforcible."  Unfortunately, we're stuck with Common Criteria requirements,
+  which do not allow for common sense.
+
+Bug 15779180 SUNBT7154101 Not able to unlock screen after xlock after su to a
+                          role
+
+- specific to Solaris RBAC
+---
+ driver/demo-Gtk.c                  | 79 ++++++++++++++++++++++++++++++++++----
+ driver/prefs.c                     | 32 +++++++++++++++
+ driver/subprocs.c                  | 24 ++++++++++++
+ driver/types.h                     |  3 ++
+ driver/xscreensaver-demo.glade2.in |  2 +-
+ driver/xscreensaver.c              | 32 +++++++++++++--
+ driver/xscreensaver.h              |  2 +
+ 7 files changed, 163 insertions(+), 11 deletions(-)
+
+diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
+index 3d86087..3a4ab09 100644
+--- a/driver/demo-Gtk.c
++++ b/driver/demo-Gtk.c
[email protected]@ -131,6 +131,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
++#include <user_attr.h>
+ 
+ #ifdef HAVE_GTK2
+ enum {
[email protected]@ -1701,9 +1702,10 @@ flush_dialog_changes_and_save (state *s)
+ # undef COPY
+ 
+ # define COPYSTR(FIELD,NAME) \
+-  if (!p->FIELD || \
++  if ((p->FIELD != p2->FIELD) && \
++      (!p->FIELD || \
+       !p2->FIELD || \
+-      strcmp(p->FIELD, p2->FIELD)) \
++      strcmp(p->FIELD, p2->FIELD))) \
+     { \
+       changed = True; \
+       if (s->debug_p) \
[email protected]@ -2765,6 +2767,70 @@ update_list_sensitivity (state *s)
+ #endif /* !HAVE_GTK2 */
+ }
+ 
++# define SENSITIZE(NAME,SENSITIVEP) \
++    gtk_widget_set_sensitive (name_to_widget (s, (NAME)), (SENSITIVEP))
++
++#define HIDEWIDGET(NAME) \
++    gtk_widget_hide (name_to_widget (s, (NAME)))
++
++static void
++customized_lock(state *s)
++{
++  char *idletime = NULL;
++  int timeout = 0;
++  char *idlecmd = NULL;
++
++  if (((idletime = getuserattruid(getuid(),
++	  USERATTR_IDLETIME_KW, NULL, NULL)) != NULL) &&
++	  ((timeout = atoi(idletime)) != 0) || timeout)
++    {
++
++      GtkWidget *timeout_spinbutton = name_to_widget(s, "timeout_spinbutton");
++      GtkAdjustment *adj = gtk_spin_button_get_adjustment((GtkSpinButton *) timeout_spinbutton);
++      SET_ADJ_UPPER(adj, (gdouble) timeout);
++      if (GET_ADJ_VALUE(adj) > (gdouble) timeout)
++        SET_ADJ_VALUE(adj, (gdouble) timeout);
++      gtk_spin_button_set_adjustment((GtkSpinButton *) timeout_spinbutton, adj);
++
++      /* enforce timeout with idlecmd */
++      if ((idlecmd = getuserattruid(getuid(),
++              USERATTR_IDLECMD_KW, NULL, NULL)) == NULL)
++        idlecmd = strdup(USERATTR_IDLECMD_LOCK_KW);
++
++      if (idlecmd && strcasecmp(idlecmd, USERATTR_IDLECMD_LOGOUT_KW) == 0)
++        {
++          gtk_label_set_text_with_mnemonic(
++              GTK_LABEL (name_to_widget (s, "timeout_label")),
++              "_Logout After");
++
++          HIDEWIDGET("cycle_label");
++          HIDEWIDGET("cycle_spinbutton");
++          HIDEWIDGET("cycle_mlabel");
++
++          HIDEWIDGET("pwd_spinbutton");
++          HIDEWIDGET("pwd_button");
++          HIDEWIDGET("pwd_mlabel");
++          HIDEWIDGET("pwd_button_eventbox");
++
++        }
++      else
++        {
++          gtk_label_set_text_with_mnemonic(
++              GTK_LABEL (name_to_widget(s, "timeout_label")),
++              "_Lock Screen After");
++        }
++      SENSITIZE("lock_spinbutton", 0);
++      SENSITIZE("lock_mlabel", 0);
++      SENSITIZE("lock_button", 0);
++
++      HIDEWIDGET("lock_spinbutton");
++      HIDEWIDGET("lock_mlabel");
++      HIDEWIDGET("lock_button");
++      HIDEWIDGET("lock_button_eventbox");
++    }
++  free(idletime); /* free works on a NULL value */
++  free(idlecmd); /* when you're all with idlecmd */
++}
+ 
+ static void
+ populate_prefs_page (state *s)
[email protected]@ -2921,10 +2987,6 @@ populate_prefs_page (state *s)
+     }
+ #endif /* HAVE_DPMS_EXTENSION */
+ 
+-
+-# define SENSITIZE(NAME,SENSITIVEP) \
+-    gtk_widget_set_sensitive (name_to_widget (s, (NAME)), (SENSITIVEP))
+-
+     /* Blanking and Locking
+      */
+     /* bugid 5077081 */
[email protected]@ -2964,10 +3026,13 @@ dpms_supported=1;
+     SENSITIZE ("fade_spinbutton", (fading_possible &&
+                                    (p->fade_p || p->unfade_p)));
+ 
+-# undef SENSITIZE
++    customized_lock(s);
++
+   }
+ }
+ 
++# undef SENSITIZE
++# undef HIDEWIDGET
+ 
+ static void
+ populate_popup_window (state *s)
+diff --git a/driver/prefs.c b/driver/prefs.c
+index 52538a8..20f3a4a 100644
+--- a/driver/prefs.c
++++ b/driver/prefs.c
[email protected]@ -37,6 +37,7 @@
+ # include "vms-pwd.h"
+ #endif /* VMS */
+ 
++#include <user_attr.h>
+ 
+ /* This file doesn't need the Xt headers, so stub these types out... */
+ #undef XtPointer
[email protected]@ -1186,6 +1187,37 @@ load_init_file (Display *dpy, saver_preferences *p)
+     if (s) free (s);
+   }
+ 
++  char *idletime = NULL;
++  int timeout = 0;
++  char *idlecmd = NULL;
++
++  if (((idletime = getuserattruid(getuid(),
++          USERATTR_IDLETIME_KW, NULL, NULL)) != NULL) &&
++          ((timeout = atoi(idletime) * 60 * 1000) != 0))
++    {
++
++      p->lock_timeout = 0;
++      if (p->timeout > timeout)
++        p->timeout = timeout;
++
++      /* always lock or logout and do not show blank screen */
++      if (p->mode == DONT_BLANK)
++        p->mode = BLANK_ONLY;
++
++      p->forcedlock_p = p->lock_p = True;
++
++      /* enforce timeout with idlecmd */
++      if ((idlecmd = getuserattruid(getuid(),
++            USERATTR_IDLECMD_KW, NULL, NULL)) == NULL)
++            idlecmd = strdup(USERATTR_IDLECMD_LOCK_KW);
++
++      if (idlecmd && strcasecmp(idlecmd, USERATTR_IDLECMD_LOGOUT_KW) == 0)
++        p->forcedlogout_p = True;
++    }
++
++  free(idletime); /* free works on a NULL value */
++  free(idlecmd); /* when you're all with idlecmd */
++
+   if (system_default_screenhack_count)  /* note: first_time is also true */
+     {
+       merge_system_screenhacks (dpy, p, system_default_screenhacks,
+diff --git a/driver/subprocs.c b/driver/subprocs.c
+index c975813..ffc435b 100644
+--- a/driver/subprocs.c
++++ b/driver/subprocs.c
[email protected]@ -940,6 +940,30 @@ check_if_hacks_dir_exists(Bool verbose_p)
+     }
+ }
+ 
++/* Added separate function for logout as we need to find better way to log user
++   out. See CR6422890. For s10 we will use /usr/bin/gnome-session-save --kill
++*/
++void
++logout(saver_screen_info *ssi)
++{
++  saver_info *si = ssi->global;
++  saver_preferences *p = &si->prefs;
++  if (!(si->emergency_lock_p || si->locked_p))
++    {
++      struct stat st;
++      if (!stat ("/usr/bin/gnome-session-save", &st))
++        {
++          pid_t forked = fork_and_exec (ssi, "/usr/bin/gnome-session-save\t--force-logout");
++          if (forked < 1)
++            {
++              char buf [255];
++              snprintf (buf, sizeof(buf), "%s: couldn't fork", blurb());
++              perror (buf);
++            }
++        }
++    }
++}
++
+ void
+ spawn_screenhack (saver_screen_info *ssi)
+ {
+diff --git a/driver/types.h b/driver/types.h
+index b428f73..adee51f 100644
+--- a/driver/types.h
++++ b/driver/types.h
[email protected]@ -97,6 +97,9 @@ struct saver_preferences {
+   Bool xsync_p;			/* whether XSynchronize has been called */
+ 
+   Bool lock_p;			/* whether to lock as well as save */
++  Bool forcedlock_p;		/* whether to forced lock */
++  Bool forcedlogout_p;		/* whether to forced logout */
++
+   Bool unlock_timeout_p;	/* whether to timeout unlock dialog */
+                                 /* bugid 5077981 */
+ 
+diff --git a/driver/xscreensaver-demo.glade2.in b/driver/xscreensaver-demo.glade2.in
+index a7a06a6..85b8069 100644
+--- a/driver/xscreensaver-demo.glade2.in
++++ b/driver/xscreensaver-demo.glade2.in
[email protected]@ -478,7 +478,7 @@
+ 			  <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ 			  <property name="snap_to_ticks">True</property>
+ 			  <property name="wrap">False</property>
+-			  <property name="adjustment">0 0 720 1 15 15</property>
++			  <property name="adjustment">0 0 720 1 15 0</property>
+ 			  <accessibility>
+ 			    <atkrelation target="pwd_button" type="controlled-by"/>
+ 			    <atkrelation target="pwd_button" type="labelled-by"/>
+diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
+index f357281..e502f01 100644
+--- a/driver/xscreensaver.c
++++ b/driver/xscreensaver.c
[email protected]@ -150,6 +150,7 @@
+ 
+ #include <stdio.h>
+ #include <ctype.h>
++#include <user_attr.h>
+ #include <X11/Xlib.h>
+ 
+ #ifdef ENABLE_NLS
[email protected]@ -1242,6 +1243,9 @@ main_loop (saver_info *si)
+ 
+       maybe_reload_init_file (si);
+ 
++      if (p->forcedlogout_p)
++        logout(&si->screens[0]);
++
+       if (p->mode == DONT_BLANK)
+         {
+           if (p->verbose_p)
[email protected]@ -1532,6 +1536,20 @@ DONE:
+ static void analyze_display (saver_info *si);
+ static void fix_fds (void);
+ 
++/*
++ * Is Role attached to userid
++ */
++Bool
++isRoleAttached(uid_t uid)
++{
++  char *type;
++  if (((type = getuserattruid(uid, USERATTR_TYPE_KW, NULL, NULL)) != NULL) &&
++	  (strcmp(type, USERATTR_TYPE_NONADMIN_KW) == 0))
++    return (B_TRUE);
++  else
++    return (B_FALSE);
++}
++
+ int
+ main (int argc, char **argv)
+ {
[email protected]@ -1542,6 +1560,14 @@ main (int argc, char **argv)
+   struct passwd *spasswd;
+   int i;
+ 
++  uid_t uid = getuid();
++  if (uid == 0 && isRoleAttached(uid))
++    {
++      fprintf(stderr, "Roles Can not login directly.\n");
++      return 1;
++    }
++
++
+   /* It turns out that if we do setlocale (LC_ALL, "") here, people
+      running in Japanese locales get font craziness on the password
+      dialog, presumably because it is displaying Japanese characters
[email protected]@ -2054,7 +2080,7 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
+   else if (type == XA_EXIT)
+     {
+       /* Ignore EXIT message if the screen is locked. */
+-      if (until_idle_p || !si->locked_p)
++      if (!(p->forcedlogout_p || p->forcedlock_p) && (until_idle_p || !si->locked_p))
+ 	{
+ 	  clientmessage_response (si, window, False,
+ 				  "EXIT ClientMessage received.",
[email protected]@ -2071,8 +2097,8 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
+ 	}
+       else
+ 	clientmessage_response (si, window, True,
+-				"EXIT ClientMessage received while locked.",
+-				"screen is locked.");
++				"EXIT ClientMessage received.",
++				"screen is locked or does not have privilege to exit.");
+     }
+   else if (type == XA_RESTART)
+     {
+diff --git a/driver/xscreensaver.h b/driver/xscreensaver.h
+index a52ba63..e688531 100644
+--- a/driver/xscreensaver.h
++++ b/driver/xscreensaver.h
[email protected]@ -170,6 +170,8 @@ extern struct screenhack_job *make_job (pid_t pid, int screen,
+                                         const char *cmd);
+ #endif
+ 
++extern void logout(saver_screen_info *ssi);
++
+ /* =======================================================================
+    subprocs diagnostics
+    ======================================================================= */
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0009-pam-audit.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,284 @@
+From ff65f319d40fdc0d5f9d316b9c5d48d7cdebc6b6 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 22:38:35 -0800
+Subject: [PATCH] pam audit
+
+Fixes for bugs:
+15201967 SUNBT5015296 xscreensaver doesn't audit
+15326852 SUNBT6417168 xscreensaver loops while trying to unlock a session
+	 	      for a user whose password was expired
+15452882 SUNBT6654320 xscreensaver dies due to memory corruption
+15688159 SUNBT7008058 screensaver continues to accept old password for
+	 	      existing sessions after password changed
+
+Also ensures that Xscreensaver on Solaris only uses PAM, and never attempts
+to fallback to direct use of getpwent(), which isn't audited
+
+Upstream status unknown.
+---
+ driver/Makefile.in  |   2 +-
+ driver/passwd-pam.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ driver/passwd.c     |   4 ++
+ 3 files changed, 161 insertions(+), 3 deletions(-)
+
+diff --git a/driver/Makefile.in b/driver/Makefile.in
+index a44e312..7aec6d9 100644
+--- a/driver/Makefile.in
++++ b/driver/Makefile.in
[email protected]@ -212,7 +212,7 @@ PDF2JPEG_LIBS	= -framework Cocoa
+ SAVER_LIBS	= $(LIBS) $(X_LIBS) $(XMU_LIBS) @[email protected] \
+ 		  $(XDPMS_LIBS) $(XINERAMA_LIBS) $(GL_LIBS) $(X_PRE_LIBS) \
+ 		  -lXt -lX11 -lXext $(X_EXTRA_LIBS) \
+-		  $(PASSWD_LIBS)
++		  -lbsm $(PASSWD_LIBS)
+ 
+ CMD_LIBS	= $(LIBS) $(X_LIBS) \
+ 		  $(X_PRE_LIBS) -lX11 -lXext $(X_EXTRA_LIBS)
+diff --git a/driver/passwd-pam.c b/driver/passwd-pam.c
+index 93c73f1..4d24ac3 100644
+--- a/driver/passwd-pam.c
++++ b/driver/passwd-pam.c
[email protected]@ -47,6 +47,8 @@
+ 
+ #ifdef __sun
+ # include <deflt.h>
++# include <bsm/adt.h>
++# include <bsm/adt_event.h>
+ #endif
+ 
+ extern char *blurb(void);
[email protected]@ -81,6 +83,9 @@ extern void unblock_sigchld (void);
+ #undef countof
+ #define countof(x) (sizeof((x))/sizeof(*(x)))
+ 
++static struct pam_response *reply = 0; /*making it global so we can free it */
++static int replies = 0;
++
+ /* Some time between Red Hat 4.2 and 7.0, the words were transposed 
+    in the various PAM_x_CRED macro names.  Yay!
+  */
[email protected]@ -178,6 +183,124 @@ Bool pam_priv_init (int argc, char **argv, Bool verbose_p);
+  */
+ static void *suns_pam_implementation_blows = 0;
+ 
++#ifdef __sun
++#include <syslog.h>
++#include <bsm/adt.h>
++#include <bsm/adt_event.h>
++
++static Bool audit_flag_global = True;
++
++/*
++ * audit_lock - audit entry to screenlock
++ *
++ *      Entry   Process running with appropriate privilege to generate
++ *                      audit records and real uid of the user.
++ *
++ *      Exit    ADT_screenlock audit record written.
++ */
++void
++audit_lock(void)
++{
++  adt_session_data_t      *ah;          /* audit session handle */
++  adt_event_data_t        *event;       /* audit event handle */
++
++  /* Audit start of screen lock -- equivalent to logout ;-) */
++  if (adt_start_session(&ah, NULL, ADT_USE_PROC_DATA) != 0)
++    {
++      syslog(LOG_AUTH | LOG_ALERT, "adt_start_session: %m");
++      return;
++    }
++  if ((event = adt_alloc_event(ah, ADT_screenlock)) == NULL)
++    {
++      syslog(LOG_AUTH | LOG_ALERT, "adt_alloc_event(ADT_screenlock): %m");
++    } else {
++      if (adt_put_event(event, ADT_SUCCESS, ADT_SUCCESS) != 0)
++        {
++          syslog(LOG_AUTH | LOG_ALERT, "adt_put_event(ADT_screenlock): %m");
++        }
++      adt_free_event(event);
++    }
++  (void) adt_end_session(ah);
++}
++
++/*
++ * audit_unlock - audit screen unlock
++ *
++ *      Entry   Process running with appropriate privilege to generate
++ *                      audit records and real uid of the user.
++ *              pam_status = PAM error code; reason for failure.
++ *
++ *      Exit    ADT_screenunlock audit record written.
++ */
++static void
++audit_unlock(int pam_status)
++{
++  adt_session_data_t      *ah;          /* audit session handle */
++  adt_event_data_t        *event;       /* audit event handle */
++
++  if (adt_start_session(&ah, NULL, ADT_USE_PROC_DATA) != 0)
++    {
++      syslog(LOG_AUTH | LOG_ALERT,
++             "adt_start_session(ADT_screenunlock): %m");
++      return;
++    }
++  if ((event = adt_alloc_event(ah, ADT_screenunlock)) == NULL)
++    {
++      syslog(LOG_AUTH | LOG_ALERT,
++             "adt_alloc_event(ADT_screenunlock): %m");
++    } else {
++      if (adt_put_event(event,
++                        pam_status == PAM_SUCCESS ? ADT_SUCCESS : ADT_FAILURE,
++                        pam_status == PAM_SUCCESS ? ADT_SUCCESS
++                                                  : ADT_FAIL_PAM + pam_status)
++          != 0)
++        {
++          syslog(LOG_AUTH | LOG_ALERT,
++                 "adt_put_event(ADT_screenunlock(%s): %m",
++                 pam_strerror(NULL, pam_status));
++        }
++      adt_free_event(event);
++    }
++  (void) adt_end_session(ah);
++}
++
++/*
++ * audit_passwd - audit password change
++ *      Entry   Process running with appropriate privilege to generate
++ *                      audit records and real uid of the user.
++ *              pam_status = PAM error code; reason for failure.
++ *
++ *      Exit    ADT_passwd audit record written.
++ */
++static void
++audit_passwd(int pam_status)
++{
++  adt_session_data_t      *ah;          /* audit session handle */
++  adt_event_data_t        *event;       /* audit event handle */
++
++  if (adt_start_session(&ah, NULL, ADT_USE_PROC_DATA) != 0)
++    {
++      syslog(LOG_AUTH | LOG_ALERT, "adt_start_session(ADT_passwd): %m");
++      return;
++    }
++  if ((event = adt_alloc_event(ah, ADT_passwd)) == NULL)
++    {
++      syslog(LOG_AUTH | LOG_ALERT, "adt_alloc_event(ADT_passwd): %m");
++    } else {
++      if (adt_put_event(event,
++                        pam_status == PAM_SUCCESS ? ADT_SUCCESS : ADT_FAILURE,
++                        pam_status == PAM_SUCCESS ? ADT_SUCCESS
++                                                  : ADT_FAIL_PAM + pam_status)
++          != 0)
++        {
++          syslog(LOG_AUTH | LOG_ALERT, "adt_put_event(ADT_passwd(%s): %m",
++                 pam_strerror(NULL, pam_status));
++        }
++      adt_free_event(event);
++    }
++  (void) adt_end_session(ah);
++}
++#endif /* sun */
+ 
+ /**
+  * This function is the PAM conversation driver. It conducts a full
[email protected]@ -231,6 +354,12 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+     fprintf (stderr, "%s: pam_start (\"%s\", \"%s\", ...) ==> %d (%s)\n",
+              blurb(), service, si->user,
+              status, PAM_STRERROR (pamh, status));
++
++#ifdef __sun
++  if (audit_flag_global) /* We want one audit lock log per lock */
++    audit_lock ();
++#endif /**sun*/
++
+   if (status != PAM_SUCCESS) goto DONE;
+ 
+ #ifdef __sun
[email protected]@ -307,6 +436,14 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+ # endif /* HAVE_SIGTIMEDWAIT */
+   unblock_sigchld();
+ 
++#ifdef __sun
++  audit_unlock(pam_auth_status);
++  if (pam_auth_status == PAM_SUCCESS)
++    audit_flag_global = True;
++  else
++    audit_flag_global = False;
++#endif /*sun*/
++
+ #ifdef HAVE_XSCREENSAVER_LOCK
+   /* Send status message to unlock dialog */
+   if (pam_auth_status == PAM_SUCCESS)
[email protected]@ -354,7 +491,14 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+             write_to_child (si, "ul_acct_ok", PAM_STRERROR(pamh, acct_rc));
+         }
+       else
+-        write_to_child (si, "ul_acct_fail", PAM_STRERROR(pamh, acct_rc));
++        {
++#ifdef __sun
++          /* Only in failure of pam_acct_mgmt case we call audit */
++          audit_unlock (acct_rc);
++#endif /*sun*/
++
++          write_to_child (si, "ul_acct_fail", PAM_STRERROR(pamh, acct_rc));
++        }
+       if (verbose_p)
+         sleep (1);
+ #endif
[email protected]@ -384,6 +528,10 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+             fprintf (stderr, "%s: pam_chauthtok (...) ==> %d (%s)\n",
+                      blurb(), chauth_rc, PAM_STRERROR(pamh, chauth_rc));
+ 
++#ifdef __sun
++          audit_passwd (chauth_rc);
++#endif /* sun */
++
+           if (chauth_rc != PAM_SUCCESS)
+             {
+               pam_auth_status = chauth_rc;
[email protected]@ -433,7 +581,13 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+             write_to_child (si, "ul_setcred_ok", PAM_STRERROR(pamh, setcred_rc));
+         }
+       else
+-        write_to_child (si, "ul_setcred_fail", PAM_STRERROR(pamh, setcred_rc));
++        {
++#ifdef __sun
++          /* Only in failure of pam_setcred() case we call audit. */
++          audit_unlock (setcred_rc);
++#endif /*sun*/
++          write_to_child (si, "ul_setcred_fail", PAM_STRERROR(pamh, setcred_rc));
++        }
+       if (verbose_p)
+         sleep (1);
+ #endif
+diff --git a/driver/passwd.c b/driver/passwd.c
+index 0618642..350dc4d 100644
+--- a/driver/passwd.c
++++ b/driver/passwd.c
[email protected]@ -81,9 +81,11 @@ extern void pam_try_unlock (saver_info *si, Bool verbose_p,
+ extern Bool ext_priv_init (int argc, char **argv, Bool verbose_p);
+ extern Bool ext_passwd_valid_p (const char *typed_passwd, Bool verbose_p);
+ #endif
++#ifndef __sun /* Only use PAM on Solaris, not direct getpwent */
+ extern Bool pwent_lock_init (int argc, char **argv, Bool verbose_p);
+ extern Bool pwent_priv_init (int argc, char **argv, Bool verbose_p);
+ extern Bool pwent_passwd_valid_p (const char *typed_passwd, Bool verbose_p);
++#endif
+ 
+ Bool lock_priv_init (int argc, char **argv, Bool verbose_p);
+ Bool lock_init (int argc, char **argv, Bool verbose_p);
[email protected]@ -107,8 +109,10 @@ struct auth_methods methods[] = {
+   { "external",		0, ext_priv_init, ext_passwd_valid_p, 0,
+   			False, False },
+ # endif
++# ifndef __sun /* Only use PAM on Solaris, not direct getpwent */
+   { "normal",           pwent_lock_init, pwent_priv_init, pwent_passwd_valid_p, 0,
+                         False, False }
++# endif
+ };
+ 
+ 
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0010-barcode-hack.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,397 @@
+From 8888dd830d16fdc8b66a7036cd1303f664d636bd Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 22:48:49 -0800
+Subject: [PATCH] barcode hack
+
+Replace words that may disturb easily-offended users or easily-worried lawyers
+with those that may entertain the easily-amused Sun engineer who had to edit
+the list.
+
+Do not remove unless you've gotten approval to ship with R-rated language
+randomly displayed on screen.   (While you could argue that out of context
+some of these words are, for instance, another name for a rooster or a cat,
+it's harder to argue when the context they're displayed in may include words
+like "boobies", "vibrator" and "Viagra".)
+
+Unlikely to be accepted upstream.
+---
+ hacks/barcode.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++-------
+ 1 file changed, 113 insertions(+), 14 deletions(-)
+
+diff --git a/hacks/barcode.c b/hacks/barcode.c
+index d659216..b883c67 100644
+--- a/hacks/barcode.c
++++ b/hacks/barcode.c
[email protected]@ -102,44 +102,66 @@ static const char *words[] =
+   "addiction",
+   "alertness",
+   "Algeria",
++  "Amber Road",
+   "anxiety",
+   "aorta",
+   "argyle socks",
+   "attrition",
++  "automagic",
+   "axis of evil",
+   "bamboo",
++  "banana slug",
+   "bangle",
+   "bankruptcy",
+   "baptism",
++  "barrelmaker",
+   "beer",
+   "bellicosity",
+   "bells",
+   "belly",
++  "Beowawe",
++  "Berkeley",
++  "BFU",
++  "Bleaklow",
+   "bliss",
+   "bogosity",
+-  "boobies",
+-  "boobs",
++  "bolthole",
++  "Boole House",
++  "boomer",
+   "booty",
+   "bread",
++  "brickify",
++  "browncoat",
+   "bubba",
+   "burrito",
++  "caiman",
+   "California",
+   "capybara",
+   "cardinality",
+   "caribou",
+   "carnage",
++  "Chicago",
+   "children",
++  "chime",
+   "chocolate",
++  "chupacabra",
++  "cinnabar",
++  "Clear View",
+   "CLONE",
+-  "cock",
++  "Colorado",
++  "Complete.",
+   "constriction",
+   "contrition",
+   "cop",
++  "corona",
+   "corpse",
+   "cowboy",
+   "crabapple",
+   "craziness",
++  "crossbow",
+   "cthulhu",
++  "cuddle",
++  "cuddletech",
+   "Death",
+   "decepticon",
+   "deception",
[email protected]@ -148,22 +170,31 @@ static const char *words[] =
+   "decoy",
+   "defenestration",
+   "democracy",
++  "dendrite",
+   "dependency",
+   "despair",
+   "desperation",
+   "disease",
+   "disease",
+   "doberman",
++  "dot com",
+   "DOOM",
+-  "dreams",
++  "DREAM",
+   "dreams",
+   "drugs",
++  "Duckwater",
++  "duraflame",
+   "easy",
+   "ebony",
++  "ecoresponsibility",
+   "election",
+   "eloquence",
++  "Elko",
++  "Ely",
++  "embiggen",
+   "emergency",
+   "eureka",
++  "every city",
+   "excommunication",
+   "fat",
+   "fatherland",
[email protected]@ -171,18 +202,29 @@ static const char *words[] =
+   "fear",
+   "fever",
+   "filth",
++  "fishworks",
++  "flask",
+   "flatulence",
+   "fluff",
+   "fnord",
++  "FOX",
++  "frak",
+   "freedom",
+   "fruit",
+-  "fruit",
++  "fugu",
+   "futility",
++  "galaxy",
++  "genunix",
+   "gerbils",
+-  "GOD",
++  "Gerlach",
+   "goggles",
+   "goobers",
+   "gorilla",
++  "greenline",
++  "green violet",
++  "grok",
++  "grub",
++  "Groom Lake",
+   "halibut",
+   "handmaid",
+   "happiness",
[email protected]@ -193,23 +235,31 @@ static const char *words[] =
+   "heroin",
+   "heroine",
+   "hope",
++  "honeycomb",
+   "hysteria",
++  "Ichthyosaur",
+   "icepick",
+   "identity",
+   "ignorance",
++  "illumonati",
+   "importance",
++  "Indiana",
+   "individuality",
+   "inkling",
+   "insurrection",
+   "intoxicant",
+   "ire",
+   "irritant",
++  "iwashi",
+   "jade",
+   "jaundice",
++  "Jet",
+   "Joyce",
++  "Jupiter",
+   "kidney stone",
+   "kitchenette",
+   "kiwi",
++  "Lahontan",
+   "lathe",
+   "lattice",
+   "lawyer",
[email protected]@ -218,32 +268,49 @@ static const char *words[] =
+   "lobbyist",
+   "love",
+   "lozenge",
++  "Lund",
++  "Mad Hatter",
+   "magazine",
+   "magnesium",
+   "malfunction",
++  "Marrakesh",
++  "Mars",
+   "marmot",
+   "marshmallow",
++  "McGill",
++  "Menlo Park",
++  "mercurial",
+   "merit",
+   "merkin",
+   "mescaline",
+   "milk",
+   "mischief",
+   "mistrust",
++  "Moapa",
+   "money",
+   "monkey",
+   "monkeybutter",
++  "Muskoka",
++  "mustang",
+   "nationalism",
+   "nature",
++  "Nevada",
++  "newt",
++  "Niagara",
+   "neuron",
+   "noise",
+   "nomenclature",
+   "nutria",
+   "OBEY",
+   "ocelot",
++  "oracle",
+   "offspring",
+   "overseer",
++  "Pahrump",
+   "pain",
+   "pajamas",
++  "panic",
++  "paravon",
+   "passenger",
+   "passion",
+   "Passover",
[email protected]@ -253,19 +320,21 @@ static const char *words[] =
+   "petticoat",
+   "pharmacist",
+   "PhD",
++  "pinenut",
++  "Pioche",
+   "pitchfork",
+   "plague",
+   "Poindexter",
+   "politician",
+   "pony",
++  "ponytail",
+   "presidency",
+   "prison",
+   "prophecy",
+-  "Prozac",
+   "punishment",
+   "punk rock",
+   "punk",
+-  "pussy",
++  "quahog",
+   "quagmire",
+   "quarantine",
+   "quartz",
[email protected]@ -274,13 +343,18 @@ static const char *words[] =
+   "rage",
+   "readout",
+   "reality",
+-  "rectum",
++  "register",
+   "reject",
+   "rejection",
++  "Reno",
+   "respect",
+   "revolution",
+   "roadrunner",
++  "rock",
+   "rule",
++  "sagebrush",
++  "Santa Clara",
++  "Santa Cruz",
+   "savor",
+   "scab",
+   "scalar",
[email protected]@ -289,25 +363,36 @@ static const char *words[] =
+   "security",
+   "sediment",
+   "self worth",
++  "shiny",
+   "sickness",
++  "sierra",
+   "silicone",
++  "Sirius",
+   "slack",
+   "slander",
+   "slavery",
+   "sledgehammer",
+-  "smegma",
+   "smelly socks",
++  "soda",
++  "solder",
++  "Sonoma",
++  "songbird",
+   "sorrow",
+   "space program",
++  "Sparks",
+   "stamen",
+   "standardization",
+   "stench",
++  "stilt",
+   "subculture",
+   "subversion",
++  "sun",
+   "suffering",
+   "surrender",
+   "surveillance",
+   "synthesis",
++  "tamarack",
++  "Tahoe",
+   "television",
+   "tenant",
+   "tendril",
[email protected]@ -315,17 +400,27 @@ static const char *words[] =
+   "terrorism",
+   "terrorist",
+   "the impossible",
++  "the possimpible",
+   "the unknown",
++  "thumper",
++  "tiger",
++  "tonic",
+   "toast",
++  "Tonopah",
+   "topography",
+   "truism",
++  "truthiness",
++  "Tsinghua",
+   "turgid",
++  "uisce",
++  "unbreakable",
+   "underbrush",
+   "underling",
+   "unguent",
+   "unusual",
+   "uplink",
+   "urge",
++  "Utah",
+   "valor",
+   "variance",
+   "vaudeville",
[email protected]@ -333,8 +428,7 @@ static const char *words[] =
+   "vegetarian",
+   "venom",
+   "verifiability",
+-  "viagra",
+-  "vibrator",
++  "vermillion",
+   "victim",
+   "vignette",
+   "villainy",
[email protected]@ -344,25 +438,30 @@ static const char *words[] =
+   "warehouse",
+   "waste",
+   "waveform",
++  "Wendover",
+   "whiffle ball",
+   "whorl",
+   "windmill",
++  "Winchester",
+   "words",
+   "worm",
+   "worship",
+   "worship",
+-  "Xanax",
++  "Wyoming",
+   "Xerxes",
+   "Xhosa",
+   "xylophone",
+   "yellow",
++  "Yerington",
+   "yesterday",
+   "your nose",
+   "Zanzibar",
+   "zeal",
+   "zebra",
+   "zest",
+-  "zinc"
++  "zettabyte",
++  "zinc",
++  "Zulu"
+ };
+ 
+ #define WORD_COUNT (sizeof(words) / sizeof(char *))
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0011-glsnake-hack.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,81 @@
+From 30508fb866ac6290c72d07f3eb626ca9866f9b95 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 22:50:21 -0800
+Subject: [PATCH] glsnake hack
+
+Remove models whose name and/or shape are in poor taste.
+
+Do not remove unless you've gotten approval to ship with NSFW
+images & language randomly displayed on screen.
+
+Unlikely to be accepted upstream.
+---
+ hacks/glx/glsnake.c | 31 -------------------------------
+ 1 file changed, 31 deletions(-)
+
+diff --git a/hacks/glx/glsnake.c b/hacks/glx/glsnake.c
+index 094b12a..c6fceb7 100644
+--- a/hacks/glx/glsnake.c
++++ b/hacks/glx/glsnake.c
[email protected]@ -536,11 +536,6 @@ static const struct model_s model[] = {
+ 	PIN, ZERO, RIGHT, RIGHT, ZERO, PIN, PIN, ZERO, PIN, PIN, ZERO,
+ 	RIGHT, ZERO }
+     },
+-    { "k's turd",
+-      { RIGHT, RIGHT, PIN, RIGHT, LEFT, RIGHT, PIN, RIGHT, LEFT,
+-	RIGHT, PIN, RIGHT, LEFT, RIGHT, PIN, RIGHT, LEFT, RIGHT, PIN,
+-	RIGHT, LEFT, RIGHT, PIN, ZERO }
+-    },
+     { "lightsabre",
+       { ZERO, ZERO, ZERO, ZERO, ZERO, PIN, PIN, ZERO, ZERO, ZERO, ZERO,
+ 	ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO,
[email protected]@ -561,26 +556,6 @@ static const struct model_s model[] = {
+ 	ZERO, PIN, ZERO, ZERO, ZERO, ZERO, PIN, ZERO, ZERO, ZERO, ZERO,
+ 	ZERO, ZERO, ZERO }
+     },
+-    { "kissy box",
+-      { PIN, ZERO, ZERO, ZERO, PIN, ZERO, ZERO, ZERO, ZERO, ZERO,
+-	ZERO, PIN, ZERO, ZERO, ZERO, ZERO, PIN, ZERO, ZERO, ZERO, ZERO,
+-	ZERO, PIN, ZERO }
+-    },
+-    { "erect penis",     /* thanks benno */
+-      { PIN, ZERO, PIN, PIN, ZERO, ZERO, PIN, ZERO, ZERO, ZERO, PIN,
+-	PIN, ZERO, ZERO, ZERO, RIGHT, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO,
+-	ZERO, ZERO }
+-    },
+-    { "flaccid penis",
+-      { PIN, ZERO, PIN, PIN, ZERO, ZERO, PIN, ZERO, ZERO, ZERO, PIN,
+-	PIN, ZERO, ZERO, ZERO, RIGHT, PIN, ZERO, ZERO, ZERO, ZERO, ZERO,
+-	ZERO, ZERO }
+-    },
+-    { "vagina",
+-      { RIGHT, ZERO, ZERO, ZERO, RIGHT, ZERO, ZERO, PIN, ZERO, ZERO,
+-	LEFT, ZERO, ZERO, ZERO, LEFT, ZERO, LEFT, PIN, LEFT, PIN, RIGHT,
+-	PIN, RIGHT, ZERO }
+-    },
+     { "mask",
+       { ZERO, RIGHT, LEFT, PIN, RIGHT, RIGHT, PIN, ZERO, ZERO, PIN,
+ 	ZERO, ZERO, PIN, ZERO, PIN, ZERO, PIN, ZERO, ZERO, PIN, ZERO,
[email protected]@ -685,9 +660,6 @@ static const struct model_s model[] = {
+     { "Bow",
+         { LEFT, LEFT, LEFT, RIGHT, LEFT, RIGHT, RIGHT, RIGHT, LEFT, LEFT, LEFT, RIGHT, LEFT, RIGHT, RIGHT, RIGHT, LEFT, LEFT, LEFT, RIGHT, LEFT, RIGHT, RIGHT , ZERO }
+     },
+-    { "bra",
+-        { RIGHT, RIGHT, LEFT, LEFT, RIGHT, LEFT, RIGHT, RIGHT, LEFT, LEFT, LEFT, RIGHT, RIGHT, RIGHT, LEFT, LEFT, RIGHT, LEFT, RIGHT, RIGHT, LEFT, LEFT, LEFT , ZERO }
+-    },
+     { "bronchosaurus",
+         { ZERO, PIN, ZERO, PIN, PIN, ZERO, PIN, ZERO, ZERO, PIN, ZERO, PIN, PIN, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, PIN , ZERO }
+     },
[email protected]@ -996,9 +968,6 @@ static const struct model_s model[] = {
+     { "Parrot",
+         { ZERO, ZERO, ZERO, ZERO, RIGHT, RIGHT, ZERO, LEFT, PIN, RIGHT, ZERO, RIGHT, ZERO, RIGHT, ZERO, RIGHT, PIN, LEFT, ZERO, RIGHT, LEFT, ZERO, PIN, ZERO }
+     },
+-    { "Penis",
+-        { PIN, PIN, RIGHT, ZERO, PIN, PIN, ZERO, PIN, ZERO, ZERO, RIGHT, PIN, LEFT, ZERO, ZERO, PIN, ZERO, PIN, PIN, ZERO, LEFT, PIN, PIN, ZERO }
+-    },
+     { "PictureComingSoon",
+         { LEFT, LEFT, ZERO, RIGHT, LEFT, PIN, RIGHT, RIGHT, PIN, RIGHT, LEFT, PIN, LEFT, RIGHT, PIN, RIGHT, RIGHT, PIN, RIGHT, LEFT, ZERO, RIGHT, RIGHT, ZERO }
+     },
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0012-bug-15426641.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,35 @@
+From b6b960fa231f478c9804c93010c4187ecd6a59da Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 22:52:17 -0800
+Subject: [PATCH] bug 15426641
+
+15426641 SUNBT6610282 On-Screen Keyboard application and desktop shown
+	 	      without unlocking xscreensaver lock screen
+
+Upstream status unknown - suspect to be specific to our GTK unlock dialog.
+---
+ driver/xscreensaver.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
+index e502f01..5f4ecb2 100644
+--- a/driver/xscreensaver.c
++++ b/driver/xscreensaver.c
[email protected]@ -450,7 +450,14 @@ saver_ehandler (Display *dpy, XErrorEvent *error)
+    "\n"
+    "\n");
+ 
++/**
++  6610282(P1) On-Screen Keyboard application and desktop shown
++         with out unlocking xscreensaver lock screen
++  The screen is still locked and it needs to cover all conditions,
++  including AT services, such as GOK, only GOK-COMPOSE should
++  be supported(others should not), there is no need to invoke
+ 	  saver_exit (si, -1, 0);
++**/
+ 	}
+     }
+ 
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0013-bug-15411287.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,35 @@
+From 4ac5532cc951b30058a1b271a7756391cd02a7a8 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 22:54:22 -0800
+Subject: [PATCH] bug 15411287
+
+15411287 SUNBT6583181 SCREENSAVER_STATUS needs to be set up correctly at startup
+
+Upstream applicability & status unknown.
+---
+ driver/xscreensaver.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
+index 5f4ecb2..926fc63 100644
+--- a/driver/xscreensaver.c
++++ b/driver/xscreensaver.c
[email protected]@ -1669,6 +1669,7 @@ main (int argc, char **argv)
+       if (ssi->real_screen_p)
+         if (ensure_no_screensaver_running (si->dpy, si->screens[i].screen))
+           exit (1);
++      ssi->current_hack = -1; /* otherwise initialize hacks to no hack */
+     }
+ 
+   lock_initialization (si, &argc, argv);
[email protected]@ -1700,6 +1701,7 @@ main (int argc, char **argv)
+ 
+   make_splash_dialog (si);
+ 
++  store_saver_status(si); /* set window property for SCREENSAVER_STATUS */
+   main_loop (si);		/* doesn't return */
+   return 0;
+ }
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0014-bug-15412661.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,34 @@
+From 57558315b40a1159a14aa05b6420d6b601e3318b Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 22:55:58 -0800
+Subject: [PATCH] bug 15412661
+
+15412661 SUNBT6585644 xscreensaver can cause KeyPress event loop between
+	 	      itself and xscreensaver-lock.
+
+Upstream status unknown - suspect to be specific to our GTK unlock dialog.
+---
+ driver/timers.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/driver/timers.c b/driver/timers.c
+index 32728a0..825c2d9 100644
+--- a/driver/timers.c
++++ b/driver/timers.c
[email protected]@ -131,6 +131,13 @@ notice_events (saver_info *si, Window window, Bool top_p)
+   unsigned int nkids;
+   int screen_no;
+ 
++  if ((si->pw_data->got_windowid) && (window == si->passwd_dialog))
++    {
++      if (p->verbose_p)
++	fprintf (stderr, "--> notice_events() breaking out of loop!\n");
++      return;
++    }
++
+   if (XtWindowToWidget (si->dpy, window))
+     /* If it's one of ours, don't mess up its event mask. */
+     return;
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0015-bug-15411306.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,28 @@
+From 31822e934b170581ecab2ffe79ce7e6ed5a189d9 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 22:58:56 -0800
+Subject: [PATCH] bug 15411306
+
+15411306 SUNBT6583247 JDS session is accessible for a while before
+	 	      xscreensaver lock is displayed on hotdesking
+
+Upstream applicability & status unknown.
+---
+ driver/windows.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/driver/windows.c b/driver/windows.c
+index 51e4c6a..4545ad7 100644
+--- a/driver/windows.c
++++ b/driver/windows.c
[email protected]@ -1581,6 +1581,7 @@ raise_window (saver_info *si,
+ 	  if (!dont_clear || ssi->stderr_overlay_window)
+ 	    clear_stderr (ssi);
+ 	  XMapRaised (si->dpy, ssi->screensaver_window);
++	  XSync(si->dpy,False); /* make sure window is raised now. */
+ #ifdef HAVE_MIT_SAVER_EXTENSION
+ 	  if (ssi->server_mit_saver_window &&
+ 	      window_exists_p (si->dpy, ssi->server_mit_saver_window))
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0016-bug-15141135.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,37 @@
+From 442f0560a7d26caa8434eba5bec6fecd5f5acb4a Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 23:04:08 -0800
+Subject: [PATCH] bug 15141135
+
+15141135 SUNBT4802301 xscreensaver should not tell root to "xhost +localhost"
+
+Upstream's opinion differs from our requirements here.
+---
+ driver/demo-Gtk.c | 11 +----------
+ 1 file changed, 1 insertion(+), 10 deletions(-)
+
+diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
+index 3a4ab09..bfc0bd5 100644
+--- a/driver/demo-Gtk.c
++++ b/driver/demo-Gtk.c
[email protected]@ -1054,16 +1054,7 @@ await_xscreensaver (state *s)
+         strcat (buf, STFU
+ 	  _("You are running as root.  This usually means that xscreensaver\n"
+             "was unable to contact your X server because access control is\n"
+-            "turned on.  Try running this command:\n"
+-            "\n"
+-            "                        xhost +localhost\n"
+-            "\n"
+-            "and then selecting `File / Restart Daemon'.\n"
+-            "\n"
+-            "Note that turning off access control will allow anyone logged\n"
+-            "on to this machine to access your screen, which might be\n"
+-            "considered a security problem.  Please read the xscreensaver\n"
+-            "manual and FAQ for more information.\n"
++            "turned on.\n"
+             "\n"
+             "You shouldn't run X as root. Instead, you should log in as a\n"
+             "normal user, and `su' as necessary."));
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0017-bug-15574928.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,41 @@
+From a9d3ad0d8b824e687dc13addc63bbdabcb7dec09 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 23:05:51 -0800
+Subject: [PATCH] bug 15574928
+
+Bug 15574928 - SUNBT6859039
+
+Upstream applicability & status unknown.
+---
+ driver/prefs.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/driver/prefs.c b/driver/prefs.c
+index 20f3a4a..c14d1be 100644
+--- a/driver/prefs.c
++++ b/driver/prefs.c
[email protected]@ -381,7 +381,21 @@ parse_init_file (saver_preferences *p)
+       return 0;
+     }
+ 
++  /*
++   * 6859039: unprivileged local users can use xscreensaver to show
++   * contents of files they don't have permission to read.
++   */
++
++  /* Drop Privilege before opening .xscreensaver file */
++  uid_t idorg = geteuid ();
++  if (seteuid (getuid ()) != 0)
++    return 0;
++
+   in = fopen(name, "r");
++
++  /* Restore Privilege */
++  seteuid (idorg);
++
+   if (!in)
+     {
+       char *buf = (char *) malloc(1024 + strlen(name));
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0018-verbose-messages.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,51 @@
+From 178bbcab5659a1090e323cf8bf7468098fa153a1 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 23:12:27 -0800
+Subject: [PATCH] verbose messages
+
+Bug 16559 - xscreensaver shows extra messages
+https://defect.opensolaris.org/bz/show_bug.cgi?id=16559
+
+Make messages that annoy users only appear when verbose is set.
+(Upstream wasn't showing these until we started capturing stderr.)
+---
+ driver/passwd.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/driver/passwd.c b/driver/passwd.c
+index 350dc4d..765741d 100644
+--- a/driver/passwd.c
++++ b/driver/passwd.c
[email protected]@ -285,8 +285,11 @@ xss_authenticate(saver_info *si, Bool verbose_p)
+           si->cached_passwd &&
+           !*si->cached_passwd)
+         {
+-          fprintf (stderr, "%s: assuming null password means cancel.\n",
+-                   blurb());
++          if (verbose_p)
++            {
++              fprintf (stderr, "%s: assuming null password means cancel.\n",
++                       blurb());
++            }
+           si->unlock_state = ul_cancel;
+         }
+ 
[email protected]@ -315,11 +318,14 @@ xss_authenticate(saver_info *si, Bool verbose_p)
+         {
+           /* If any auth method gets a cancel or timeout, don't try the
+              next auth method!  We're done! */
+-          fprintf (stderr,
++          if (verbose_p)
++            {
++              fprintf (stderr,
+                    "%s: authentication via %s %s.\n",
+                        blurb(), methods[i].name,
+                    (si->unlock_state == ul_cancel
+                     ? "cancelled" : "timed out"));
++            }
+           goto DONE;
+         }
+     }
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0019-bug-15706879.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,58 @@
+From 404ef6681b57a43c006b92358ff7794867e01239 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 23:13:46 -0800
+Subject: [PATCH] bug 15706879
+
+15706879 SUNBT7033508 Xscreensaver "Black Screen Only" module shows
+	 	      portions of display when session is locked
+
+Upstream applicability & status unknown.
+---
+ driver/lock.c         | 4 ++--
+ driver/xscreensaver.c | 1 -
+ 2 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/driver/lock.c b/driver/lock.c
+index 08f0f98..dc40ca4 100644
+--- a/driver/lock.c
++++ b/driver/lock.c
[email protected]@ -918,6 +918,7 @@ new_passwd_window (saver_info *si)
+                blurb(), pw->prompt_screen->number);
+   }
+ 
++#ifdef CR7033508
+   /* Before mapping the window, save a pixmap of the current screen.
+      When we lower the window, we restore these bits.  This works,
+      because the running screenhack has already been sent SIGSTOP, so
[email protected]@ -939,6 +940,7 @@ new_passwd_window (saver_info *si)
+ 	       0, 0);
+     XFreeGC (si->dpy, gc);
+   }
++#endif /*CR7033508*/
+ 
+   si->pw_data = pw;
+   return 0;
[email protected]@ -3125,8 +3127,6 @@ unlock_p (saver_info *si)
+       return False;
+     }
+ 
+-  raise_window (si, True, True, True);
+-
+   xss_authenticate(si, p->verbose_p);
+ 
+   return (si->unlock_state == ul_success);
+diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
+index 926fc63..7ac855f 100644
+--- a/driver/xscreensaver.c
++++ b/driver/xscreensaver.c
[email protected]@ -1349,7 +1349,6 @@ main_loop (saver_info *si)
+       for (i = 0; i < si->nscreens; i++)
+         kill_screenhack (&si->screens[i]);
+ 
+-      raise_window (si, True, True, False);
+       if (si->throttled_p || getuid () == 0)
+         fprintf (stderr, "%s: not launching hack (throttled.)\n", blurb());
+       else
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0020-bug-15769303.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,374 @@
+From a946e560758d0041aea4fc55ee7f5f657cbe27df Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 2 Jan 2016 23:16:21 -0800
+Subject: [PATCH] bug 15769303
+
+15769303 SUNBT7136531 xscreensaver incorrectly processes PAM_ERROR_MSG
+	 	      and possibly PAM_TEXT_INFO
+
+Displayed PAM_ERROR_MSG and PAM_TEXT_INFO at Locked screen with Dismiss
+button.  After reading message, user can click Dismiss button or press
+Enter to close the Locked Screen.
+
+Upstream applicability & status unknown.
+---
+ driver/lock-Gtk.c   | 45 +++++++++++++++++++++--------
+ driver/lock.c       | 49 ++++++++++++++++++++++++++------
+ driver/passwd-pam.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++----
+ 3 files changed, 150 insertions(+), 25 deletions(-)
+
+diff --git a/driver/lock-Gtk.c b/driver/lock-Gtk.c
+index 13e0213..cbb70a2 100644
+--- a/driver/lock-Gtk.c
++++ b/driver/lock-Gtk.c
[email protected]@ -394,11 +394,13 @@ make_dialog (gboolean center_pos)
+                        NULL);
+ 
+   /* Ok button */
+-  button = gtk_button_new_from_stock (GTK_STOCK_OK);
++  button = g_object_new (GTK_TYPE_BUTTON, "visible", FALSE, "label",
++                         "Dismiss",  "can_focus", TRUE, NULL) ;
+   pwd->button = button;
+ 
+   gtk_box_pack_end (GTK_BOX (bbox), button,
+                     FALSE, TRUE, 0);
++  gtk_box_pack_start (GTK_BOX (vbox2), bbox, FALSE, FALSE, 0);
+ 
+   free (user);
+   free (version);
[email protected]@ -417,18 +419,26 @@ ok_clicked_cb (GtkWidget *button, PasswdDialog *pwd)
+ {
+   const char *s;
+ 
+-  g_object_set (pwd->msg_label, "label", _("<b>Checking...</b>"), NULL);
++  if (GTK_IS_BUTTON (button) && gtk_widget_get_visible (button)) /* Is it Dismiss Dialog Box */
++    {
++      write_to_parent ("dismiss", "true", TRUE);
++      gtk_widget_hide (button);
++    }
++  else
++    {
++      g_object_set (pwd->msg_label, "label", _("<b>Checking...</b>"), NULL);
+ 
+-  s = gtk_entry_get_text (GTK_ENTRY (pwd->user_input_entry));
+-  write_to_parent ("input", s, TRUE);
++      s = gtk_entry_get_text (GTK_ENTRY (pwd->user_input_entry));
++      write_to_parent ("input", s, TRUE);
+ 
+-  /* Reset password field to blank, else passwd field shows old passwd *'s,
+-     visible when passwd is expired, and pam is walking the user to change
+-     old passwd.
+-   */
+-  gtk_editable_delete_text (GTK_EDITABLE (pwd->user_input_entry), 0, -1);
+-  gtk_widget_hide (pwd->user_input_entry);
+-  gtk_widget_hide (pwd->user_prompt_label);
++      /* Reset password field to blank, else passwd field shows old passwd *'s,
++         visible when passwd is expired, and pam is walking the user to change
++         old passwd.
++       */
++      gtk_editable_delete_text (GTK_EDITABLE (pwd->user_input_entry), 0, -1);
++      gtk_widget_hide (pwd->user_input_entry);
++      gtk_widget_hide (pwd->user_prompt_label);
++    }
+ }
+ 
+ static void
[email protected]@ -445,6 +455,10 @@ connect_signals (PasswdDialog *pwd)
+   g_signal_connect (pwd->dialog, "delete-event",
+                     G_CALLBACK (gtk_main_quit),
+                     NULL);
++
++  g_signal_connect (pwd->button, "button-press-event",
++                    G_CALLBACK (ok_clicked_cb),
++                    pwd);
+ }
+ 
+ static GdkFilterReturn
[email protected]@ -561,6 +575,7 @@ handle_input (GIOChannel *source, GIOCondition cond, gpointer data)
+             {
+               gtk_label_set_text (GTK_LABEL (pwd->user_prompt_label), msgstr);
+               gtk_widget_show (pwd->user_prompt_label);
++              gtk_widget_hide (pwd->button);
+               msgstr = NULL; /* clear message so we don't show it twice */
+             }
+           else if ((strcmp (str, "ul_prompt_echo") == 0))
[email protected]@ -595,6 +610,14 @@ handle_input (GIOChannel *source, GIOCondition cond, gpointer data)
+             {
+               hmsg = NULL; /* only show msg */
+             }
++          else if ((strcmp (str, "ul_pam_msg") == 0))
++            {
++              GTK_WIDGET_SET_FLAGS (pwd->button,GTK_CAN_DEFAULT);
++              gtk_widget_show (pwd->button);
++              gtk_widget_grab_default (pwd->button);
++              gtk_widget_grab_focus (pwd->button);
++              hmsg = NULL; /* only show msg */
++            }
+           else
+             {
+               /* Should not be others, but if so just show it */
+diff --git a/driver/lock.c b/driver/lock.c
+index dc40ca4..b494eae 100644
+--- a/driver/lock.c
++++ b/driver/lock.c
[email protected]@ -437,6 +437,10 @@ handle_passwd_input (XtPointer xtdata, int *fd, XtInputId *id)
+       pw->passwd_string = strdup (data);
+       memset (data, 0, strlen(data));
+     }
++  else if ((strcmp(msg, "dismiss") == 0)) /* Dismiss Dialog */
++    {
++      si->unlock_state = ul_finished;
++    }
+   else if ((strcmp(msg, "ungrab_keyboard") == 0))
+     {
+       /* An accessibility helper needs to access the keyboard, so we have
[email protected]@ -514,7 +518,7 @@ handle_passwd_input (XtPointer xtdata, int *fd, XtInputId *id)
+               si->num_typeahead_events = 0;
+             }
+           XGrabKeyboard (si->dpy, window, True, GrabModeAsync, GrabModeAsync, CurrentTime);
+-          XGrabPointer (si->dpy, window, True, 0, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
++          XGrabPointer (si->dpy, window, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
+           XFlush (si->dpy);
+           XSetInputFocus (si->dpy, window, RevertToPointerRoot, CurrentTime);
+           XSync (si->dpy, False);
[email protected]@ -957,7 +961,7 @@ static int
+ make_passwd_window (saver_info *si,
+ 		    const char *info_msg,
+ 		    const char *prompt,
+-		    Bool echo)
++		    Bool echo, Bool dismissDialog)
+ {
+ #ifndef HAVE_XSCREENSAVER_LOCK
+   XSetWindowAttributes attrs;
[email protected]@ -1006,7 +1010,7 @@ make_passwd_window (saver_info *si,
+     }
+ 
+   if (info_msg)
+-    write_to_child (si, "ul_message", info_msg);
++    write_to_child (si,  dismissDialog ? "ul_pam_msg" : "ul_message", info_msg);
+   if (prompt)
+     {
+       write_to_child (si, "ul_pamprompt", prompt);
[email protected]@ -2719,8 +2723,22 @@ passwd_event_loop (saver_info *si)
+           handle_passwd_key (si, &event.x_event.xkey);
+           si->pw_data->caps_p = (event.x_event.xkey.state & LockMask);
+         }
+-#ifndef HAVE_XSCREENSAVER_LOCK
+-      else if (event.x_event.xany.type == ButtonPress || 
++#ifdef HAVE_XSCREENSAVER_LOCK
++      else if ( event.x_event.xany.type == ButtonPress)
++        {
++          Bool status;
++          status= safe_XSendEvent (si->dpy, si->passwd_dialog,
++                                   False, ButtonPressMask, &event.x_event);
++          if (si->prefs.verbose_p)
++            {
++              if (status)
++                fprintf (stderr, "sent Button Press...\n");
++              else
++                fprintf (stderr, "error %d  Button Press...\n", status);
++            }
++        }
++#else
++      else if (event.x_event.xany.type == ButtonPress ||
+                event.x_event.xany.type == ButtonRelease)
+ 	{
+ 	  si->pw_data->button_state_changed_p = True;
[email protected]@ -2937,6 +2955,8 @@ gui_auth_conv(int num_msg,
+   const char *info_msg, *prompt;
+   struct auth_response *responses;
+ 
++  Bool dismissDialog = False;
++
+   if (si->unlock_state == ul_cancel ||
+       si->unlock_state == ul_time)
+     /* If we've already cancelled or timed out in this PAM conversation,
[email protected]@ -2977,9 +2997,14 @@ gui_auth_conv(int num_msg,
+ 	info_msg_trimmed = remove_trailing_whitespace(info_msg);
+ 	prompt_trimmed = remove_trailing_whitespace(prompt);
+ 
++        if( info_msg_trimmed != NULL &&  prompt_trimmed == NULL )
++            dismissDialog = True;
++        else
++            dismissDialog = False;
++
+ 	if (make_passwd_window(si, info_msg_trimmed, prompt_trimmed,
+                                auth_msgs[i].type == AUTH_MSGTYPE_PROMPT_ECHO
+-                               ? True : False)
++                               ? True : False, dismissDialog)
+             < 0)
+           goto fail;
+ 
[email protected]@ -3001,6 +3026,9 @@ gui_auth_conv(int num_msg,
+       handle_typeahead (si);
+       passwd_event_loop (si);
+ 
++      if( dismissDialog )
++          goto fail; /* If it is DismissDialog, no response message */
++
+       if (si->unlock_state == ul_cancel)
+ 	goto fail;
+ 
[email protected]@ -3040,10 +3068,13 @@ fail:
+     {
+       for (i = 0; i < num_msg; ++i)
+ 	if (responses[i].response)
+-	  free (responses[i].response);
++          {
++            bzero(responses[i].response, strlen(responses[i].response));
++            free (responses[i].response);
++          }
+       free (responses);
+     }
+-
++  *resp = NULL;
+   return -1;
+ }
+ 
[email protected]@ -3084,7 +3115,7 @@ auth_finished_cb (saver_info *si)
+   else						/* good, with no failures, */
+     goto END;					/* or timeout, or cancel. */
+ 
+-  make_passwd_window (si, s, NULL, True);
++  make_passwd_window (si, s, NULL, True, False);
+   XSync (si->dpy, False);
+ 
+   {
+diff --git a/driver/passwd-pam.c b/driver/passwd-pam.c
+index 4d24ac3..f5cd07c 100644
+--- a/driver/passwd-pam.c
++++ b/driver/passwd-pam.c
[email protected]@ -541,7 +541,7 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
+       else if (acct_rc != PAM_SUCCESS)
+         {
+           pam_auth_status = acct_rc;
+-          write_to_child (si, "pw_acct_fail", PAM_STRERROR(pamh, acct_rc));
++          write_to_child (si, "ul_acct_fail", PAM_STRERROR(pamh, acct_rc));
+           sleep (3);
+           goto DONE;
+         }
[email protected]@ -726,6 +726,7 @@ pam_conversation (int nmsgs,
+   struct pam_response *pam_responses;
+   saver_info *si = (saver_info *) vsaver_info;
+   Bool verbose_p;
++  size_t msg_len = 0;
+ 
+   /* On SunOS 5.6, the `closure' argument always comes in as random garbage. */
+   si = (saver_info *) suns_pam_implementation_blows;
[email protected]@ -741,6 +742,20 @@ pam_conversation (int nmsgs,
+    * pass along whatever was passed in here.
+    */
+ 
++  if (nmsgs >= PAM_MAX_NUM_MSG)
++    {
++      if (verbose_p)
++        {
++          fprintf (stderr, "Too many PAM messages "
++                  "%d >= %d\n", nmsgs, PAM_MAX_NUM_MSG);
++        }
++
++      syslog (LOG_AUTH | LOG_ERR, "Too many PAM messages "
++               "%d >= %d", nmsgs, PAM_MAX_NUM_MSG);
++      *resp = NULL;
++      return (PAM_CONV_ERR);
++    }
++
+   messages = calloc(nmsgs, sizeof(struct auth_message));
+   pam_responses = calloc(nmsgs, sizeof(*pam_responses));
+   
[email protected]@ -752,6 +767,34 @@ pam_conversation (int nmsgs,
+ 
+   for (i = 0; i < nmsgs; ++i)
+     {
++
++      if (msg[i]->msg == NULL)
++        {
++          if (verbose_p)
++            {
++              fprintf (stderr, "PAM message[%d] "
++                      "style %d NULL\n", i, msg[i]->msg_style);
++            }
++          syslog (LOG_AUTH | LOG_WARNING, "PAM message[%d] "
++                  "style %d NULL", i, msg[i]->msg_style);
++          goto end;
++        }
++
++        msg_len = strlen (msg[i]->msg);
++
++        if (msg_len > PAM_MAX_MSG_SIZE)
++          {
++            if (verbose_p)
++              {
++                fprintf (stderr, "PAM message[%d] "
++                        " style %d length %d too long\n",
++                        i, msg[i]->msg_style, msg_len);
++              }
++             syslog (LOG_AUTH | LOG_WARNING, "PAM message[%d] "
++                     "style %d length %d too long",i, msg[i]->msg_style, msg_len);
++             goto end;
++          }
++
+       if (verbose_p && i > 0) fprintf (stderr, ", ");
+ 
+       messages[i].msg = msg[i]->msg;
[email protected]@ -769,9 +812,16 @@ pam_conversation (int nmsgs,
+       case PAM_TEXT_INFO:       messages[i].type = AUTH_MSGTYPE_INFO;
+         if (verbose_p) fprintf (stderr, "TEXT_INFO");
+         break;
+-      default:                  messages[i].type = AUTH_MSGTYPE_PROMPT_ECHO;
+-        if (verbose_p) fprintf (stderr, "PROMPT_ECHO");
+-        break;
++      default:
++         if (verbose_p)
++           {
++             fprintf (stderr, "Invalid PAM "
++                     "message style %d\n", msg[i]->msg_style);
++           }
++          syslog (LOG_AUTH | LOG_WARNING, "Invalid PAM "
++                 "message style %d", msg[i]->msg_style);
++
++          goto end;
+       }
+ 
+       if (verbose_p) 
[email protected]@ -793,8 +843,28 @@ pam_conversation (int nmsgs,
+ 
+   if (ret == 0)
+     {
++      msg_len = 0;
+       for (i = 0; i < nmsgs; ++i)
+-	pam_responses[i].resp = authresp[i].response;
++      {
++        if (authresp[i].response)
++            msg_len = strlen (authresp[i].response);
++
++        if (msg_len > PAM_MAX_RESP_SIZE)
++          {
++            if (verbose_p)
++              {
++                fprintf (stderr, "PAM "
++                        "message[%d] style %d response %d too long\n",
++                        i, msg[i]->msg_style, msg_len);
++              }
++            syslog (LOG_AUTH | LOG_WARNING, "PAM "
++                    "message[%d] style %d response %d too long",
++                    i, msg[i]->msg_style, msg_len);
++            ret = -1;
++            goto end;
++          }
++        pam_responses[i].resp = authresp[i].response;
++      }
+     }
+ 
+ end:
[email protected]@ -818,6 +888,7 @@ end:
+     if (pam_responses)
+       free(pam_responses);
+ 
++    *resp == NULL;
+     return PAM_CONV_ERR;
+ }
+ 
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0021-forkpty.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,45 @@
+From 441a8b986e5a1d24e9930fdfd1129804d29775db Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Thu, 4 Feb 2016 13:32:28 -0800
+Subject: [PATCH] forkpty
+
+Fix builds on s12_91 & later, since configure picks up that libc has forkpty()
+but doesn't realize we stuck the required definitions in <sys/termios.h>
+instead of <pty.h> or <util.h>
+
+Sent upstream on 05 Feb 2016, no response yet.
+---
+ configure.in       | 2 +-
+ utils/textclient.c | 3 +++
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/configure.in b/configure.in
+index 873299e..f8f746b 100644
+--- a/configure.in
++++ b/configure.in
[email protected]@ -3547,7 +3547,7 @@ fi
+ ###############################################################################
+ 
+ PTY_LIBS=
+-AC_CHECK_HEADERS(pty.h util.h)
++AC_CHECK_HEADERS(pty.h util.h sys/termios.h)
+ AC_CHECK_X_LIB(util, forkpty,
+                [PTY_LIBS="-lutil"
+                 ac_have_forkpty=yes
+diff --git a/utils/textclient.c b/utils/textclient.c
+index abb6f11..bff816e 100644
+--- a/utils/textclient.c
++++ b/utils/textclient.c
[email protected]@ -50,6 +50,9 @@
+ # ifdef HAVE_UTIL_H
+ #  include <util.h>
+ # endif
++# ifdef HAVE_SYS_TERMIOS_H
++#  include <sys/termios.h>
++# endif
+ #endif /* HAVE_FORKPTY */
+ 
+ #undef DEBUG
+-- 
+2.6.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/xscreensaver/patches/0022-photopile-title.patch	Tue Mar 08 09:00:31 2016 -0800
@@ -0,0 +1,27 @@
+From a006863efaf40e8c1e2bffb68fb3ce4c2dfb149d Mon Sep 17 00:00:00 2001
+From: John Beck <[email protected]>
+Date: Fri, 4 Mar 2016 17:39:18 -0800
+Subject: [PATCH] photopile title
+
+This patch was developed in-house, offered upstream, but rejected because
+of a difference of opinion about typical settings for font and screen sizes.
+---
+ hacks/glx/photopile.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hacks/glx/photopile.c b/hacks/glx/photopile.c
+index 29617aa..8c96188 100644
+--- a/hacks/glx/photopile.c
++++ b/hacks/glx/photopile.c
[email protected]@ -640,7 +640,7 @@ draw_image (ModeInfo *mi, int i, GLfloat t, GLfloat s, GLfloat z)
+       XCharStruct e;
+ 
+       /* #### Highly approximate, but doing real clipping is harder... */
+-      int max = 35;
++      int max = 61;
+       if (strlen(title) > max)
+         title += strlen(title) - max;
+ 
+-- 
+2.6.1
+
--- a/components/desktop/xscreensaver/patches/01-intltool.patch	Mon Mar 07 13:01:10 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-Fix old Makefile.in.in to work with newer intltool
-
-Already upstream in later releases
-
----
- po/Makefile.in.in |    6 ++++++
- 1 files changed, 6 insertions(+), 0 deletions(-)
-
-diff --git a/po/Makefile.in.in b/po/Makefile.in.in
---- a/po/Makefile.in.in
-+++ b/po/Makefile.in.in
[email protected]@ -84,6 +84,9 @@
- #       refering to $(srcdir) anyway.  So I just commented (my half-fixed
- #       version of) this rule out.
- #
-+# The following line is needed to keep the intltool.m4 autoconf macros from
-+# throwing an error message:
-+# INTLTOOL_MAKEFILE
- 
- GETTEXT_PACKAGE = @[email protected]
- PACKAGE = @[email protected]
[email protected]@ -149,6 +152,9 @@ TARFILES = $(DISTFILES_1) $(POFILES) $(SOURCES)
- 
- POTFILES = \
- 
-+# Don't delete this line!
-+# Need to keep a non-blank line after POTFILES for sed commands from
-+# aclocal.m4 to generate Makefile from Makefile.in without losing CATALOGS
- CATALOGS = @[email protected]
- CATOBJEXT = @[email protected]
- INSTOBJEXT = @[email protected]
--- a/components/desktop/xscreensaver/patches/02-Solaris.app-defaults.patch	Mon Mar 07 13:01:10 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,224 +0,0 @@
-Various settings to meet Solaris policies/preferences, including:
-
-   -     enable screen lock by default, disable splash screen
-   -     disable using screen grabs in hacks to avoid security leaks
-   -     set default mode to screen blank
-   -     disable bsod by default to avoid confusion in shops with real NT boxes
-   -     enable & disable various hacks by default for branding reasons
-   -     branding changes for various hacks & defaults (like RSS feed)
-15162280 SUNBT4871833 DPMS settings should be consistent between CDE and Gnome
-15305084 SUNBT6368607 increase unlock dialog box timeout to 2 minutes
-15379785 SUNBT6526791 xscreensaver and Xorg need to change timeouts for MOU4
-15451768 SUNBT6652454 xscreensaver does not invoke after IDLE time expires
-
-Not suitable for upstream as these represent our differences of opinion or
-differences of requirements with upstreams.
-
----
- driver/XScreenSaver.ad.in |   68 ++++++++++++++++++++++-----------------------
- 1 files changed, 33 insertions(+), 35 deletions(-)
-
-diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in
---- a/driver/XScreenSaver.ad.in
-+++ b/driver/XScreenSaver.ad.in
[email protected]@ -28,42 +28,43 @@
- 
- ! /* (xrdb prevention kludge: whole file)
- 
--*mode:			random
-+! We want the default mode to be just blank the screen
-+*mode:	      	      	blank
- *timeout:		0:10:00
- *cycle:			0:10:00
- *lockTimeout:		0:00:00
--*passwdTimeout:		0:00:30
--*dpmsEnabled:		False
-+*passwdTimeout:		0:02:00
-+*dpmsEnabled:		True
- *dpmsQuickoffEnabled:	False
--*dpmsStandby:		2:00:00
--*dpmsSuspend:		2:00:00
--*dpmsOff:		4:00:00
--*grabDesktopImages:	True
-+*dpmsStandby:		0:10:00
-+*dpmsSuspend:		0:10:00
-+*dpmsOff:		0:10:00
-+*grabDesktopImages:	False
- *grabVideoFrames:	False
- *chooseRandomImages:	@[email protected]
- ! This can be a local directory name, or the URL of an RSS or Atom feed.
- *imageDirectory:	@[email protected]
--*nice:			10
-+*nice:			19
- *memoryLimit:		0
--*lock:			False
-+*lock:			True
- *verbose:		False
- *timestamp:		True
- *fade:			True
- *unfade:		False
- *fadeSeconds:		0:00:03
- *fadeTicks:		20
--*splash:		True
-+*splash:		False
- *splashDuration:	0:00:05
- *visualID:		default
- *captureStderr: 	True
- *ignoreUninstalledPrograms: False
- 
--*textMode:		file
-+*textMode:		date
- *textLiteral:		XScreenSaver
- *textFile:		@[email protected]
--*textProgram:		fortune
--*textURL:		http://twitter.com/statuses/public_timeline.atom
--!*textURL:		http://www.livejournal.com/stats/latest-rss.bml
-+*textProgram:		date
-+*textURL:		http://blogs.oracle.com/observatory/en_US/feed/entries/atom
-+!*textURL:		http://twitter.com/statuses/public_timeline.atom
- 
- *overlayTextForeground:	#FFFF00
- *overlayTextBackground:	#000000
[email protected]@ -76,7 +77,7 @@
- *procInterrupts:	True
- 
- ! Turning this on makes pointerHysteresis not work.
--*xinputExtensionDev:	False
-+*xinputExtensionDev:	True
- 
- ! Set this to True if you are experiencing longstanding XFree86 bug #421
- ! (xscreensaver not covering the whole screen)
[email protected]@ -160,23 +161,23 @@ GetViewPortIsFullOfLies: False
- @[email protected] GL: 				superquadrics -root			    \n\
- 				attraction -root			    \n\
- 				blitspin -root				    \n\
--				greynetic -root				    \n\
--				helix -root				    \n\
-+-				greynetic -root				    \n\
-+-				helix -root				    \n\
- 				hopalong -root				    \n\
- 				imsmap -root				    \n\
- -				noseguy -root				    \n\
- -				pyro -root				    \n\
- 				qix -root				    \n\
- -				rocks -root				    \n\
--				rorschach -root				    \n\
-+-				rorschach -root				    \n\
- 				decayscreen -root			    \n\
--				flame -root				    \n\
-+-				flame -root				    \n\
- 				halo -root				    \n\
- 				slidescreen -root			    \n\
--				pedal -root				    \n\
-+-				pedal -root				    \n\
- 				bouboule -root				    \n\
- -				braid -root				    \n\
--				coral -root				    \n\
-+-				coral -root				    \n\
- 				deco -root				    \n\
- 				drift -root				    \n\
- -				fadeplot -root				    \n\
[email protected]@ -185,13 +186,13 @@ GetViewPortIsFullOfLies: False
- 				grav -root				    \n\
- 				ifs -root				    \n\
- @[email protected] GL: 				jigsaw -root				    \n\
--				julia -root				    \n\
-+-				julia -root				    \n\
- -				kaleidescope -root			    \n\
- @[email protected] GL: 				moebius -root				    \n\
--				moire -root				    \n\
-+-				moire -root				    \n\
- @[email protected] GL: 				morph3d -root				    \n\
- 				mountain -root				    \n\
--				munch -root				    \n\
-+-				munch -root				    \n\
- 				penrose -root				    \n\
- @[email protected] GL: 				pipes -root				    \n\
- 				rd-bomb -root				    \n\
[email protected]@ -206,7 +207,7 @@ GetViewPortIsFullOfLies: False
- 				xjack -root				    \n\
- 				xlyap -root				    \n\
- @[email protected] GL: 				atlantis -root				    \n\
--				bsod -root				    \n\
-+-				bsod -root				    \n\
- @[email protected] GL: 				bubble3d -root				    \n\
- @[email protected] GL: 				cage -root				    \n\
- -				crystal -root				    \n\
[email protected]@ -219,7 +220,7 @@ GetViewPortIsFullOfLies: False
- 				interference -root			    \n\
- 				kumppa -root				    \n\
- @[email protected] GL: 				lament -root				    \n\
--				moire2 -root				    \n\
-+-				moire2 -root				    \n\
- @[email protected] GL: 				sonar -root				    \n\
- @[email protected] GL: 				stairs -root				    \n\
- 				truchet -root				    \n\
[email protected]@ -227,9 +228,9 @@ GetViewPortIsFullOfLies: False
- 				blaster -root				    \n\
- 				bumps -root				    \n\
- 				ccurve -root				    \n\
--				compass -root				    \n\
-+-				compass -root				    \n\
- 				deluxe -root				    \n\
---				demon -root				    \n\
-+				demon -root				    \n\
- @[email protected] GL: 				extrusion -root				    \n\
- -				loop -root				    \n\
- 				penetrate -root				    \n\
[email protected]@ -243,7 +244,7 @@ GetViewPortIsFullOfLies: False
- 				squiral -root				    \n\
- 				wander -root				    \n\
- -				webcollage -root			    \n\
--				xflame -root				    \n\
-+				xflame -root -bitmap /usr/lib/xscreensaver/config/unlock-logo.png \n\
- 				xmatrix -root				    \n\
- @[email protected] GL: 				gflux -root				    \n\
- -				nerverot -root				    \n\
[email protected]@ -258,14 +259,14 @@ GetViewPortIsFullOfLies: False
- @[email protected] GL: 				menger -root				    \n\
- @[email protected] GL: 				molecule -root				    \n\
- 				rotzoomer -root				    \n\
--				speedmine -root				    \n\
-+-				speedmine -root				    \n\
- @[email protected] GL: 				starwars -root				    \n\
- @[email protected] GL: 				stonerview -root			    \n\
- 				vermiculate -root			    \n\
- 				whirlwindwarp -root			    \n\
- 				zoom -root				    \n\
- 				anemone -root				    \n\
--				apollonian -root			    \n\
-+-				apollonian -root			    \n\
- @[email protected] GL: 				boxed -root				    \n\
- @[email protected] GL: 				cubenetic -root				    \n\
- @[email protected] GL: 				endgame -root				    \n\
[email protected]@ -294,12 +295,11 @@ GetViewPortIsFullOfLies: False
- @[email protected] GL: 				cubestorm -root				    \n\
- 				eruption -root				    \n\
- @[email protected] GL: 				flipflop -root				    \n\
[email protected][email protected] GL: 				flyingtoasters -root			    \n\
- 				fontglide -root				    \n\
- @[email protected] GL: 				gleidescope -root			    \n\
- @[email protected] GL: 				glknots -root				    \n\
- @[email protected] GL: 				glmatrix -root				    \n\
--- GL: 				glslideshow -root			    \n\
[email protected][email protected] GL: 				glslideshow -root			    \n\
- @[email protected] GL: 				hypertorus -root			    \n\
- - GL: 				jigglypuff -root			    \n\
- 				metaballs -root				    \n\
[email protected]@ -319,7 +319,6 @@ GetViewPortIsFullOfLies: False
- 				intermomentary -root			    \n\
- 				memscroller -root			    \n\
- @[email protected] GL: 				noof -root				    \n\
--				pacman -root				    \n\
- @[email protected] GL: 				pinion -root				    \n\
- @[email protected] GL: 				polyhedra -root				    \n\
- - GL: 				providence -root			    \n\
[email protected]@ -451,7 +450,6 @@ XScreenSaver.bourneShell:		/bin/sh
- *hacks.flipscreen3d.name:   FlipScreen3D
- *hacks.fliptext.name:       FlipText
- *hacks.fluidballs.name:     FluidBalls
--*hacks.flyingtoasters.name: FlyingToasters
- *hacks.fontglide.name:      FontGlide
- *hacks.fuzzyflakes.name:    FuzzyFlakes
- *hacks.gflux.name:          GFlux
-
--- a/components/desktop/xscreensaver/patches/03-GNOME-desktop.patch	Mon Mar 07 13:01:10 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-Changes needed for integration into GNOME desktop menus on Solaris.
-Localized name & tooltips (Sun bug 5103358 / Oracle bug 15227916)
-
-Unknown why this differs from upstream - need to find out someday.
-
----
- driver/screensaver-properties.desktop.in |   34 ++++++++++++++++++++++++++---
- 1 files changed, 30 insertions(+), 4 deletions(-)
-
-diff --git a/driver/screensaver-properties.desktop.in b/driver/screensaver-properties.desktop.in
---- a/driver/screensaver-properties.desktop.in
-+++ b/driver/screensaver-properties.desktop.in
[email protected]@ -1,8 +1,34 @@
- [Desktop Entry]
- Exec=xscreensaver-demo
--Icon=xscreensaver
-+Icon=gnome-ccscreensaver.png
- Terminal=false
--_Name=Screensaver
--_Comment=Change screensaver properties
-+Name=Screensaver
-+Name[cs]=Spořič obrazovky
-+Name[de]=Bildschirmschoner
-+Name[es]=Salvapantallas
-+Name[fr]=Économiseur d'écran
-+Name[hu]=Képernyővédő
-+Name[it]=Salvaschermo
-+Name[ja]=スクリーンセーバー
-+Name[ko]=화면 보호기
-+Name[pt_BR]=Protetor de tela
-+Name[sv]=Skärmsläckare
-+Name[zh_CN]=屏幕保护程序
-+Name[zh_HK]=螢幕保護程式
-+Name[zh_TW]=螢幕保護程式
-+Comment=Choose screensaver delay and appearance.
-+Comment[cs]=Konfigurace nastavení spořiče obrazovky.
-+Comment[de]=Bildschirmschonereinstellungen konfigurieren
-+Comment[es]=Configura los valores del salvapantallas.
-+Comment[fr]=Configurer les paramètres de l'économiseur d'écran.
-+Comment[hu]=A képernyővédő beállításainak megváltoztatása
-+Comment[it]=Configura le impostazioni del salvaschermo.
-+Comment[ja]=スクリーンセーバーを設定
-+Comment[ko]=화면 보호기 설정 구성
-+Comment[pt_BR]=Definir as configurações do protetor de tela.
-+Comment[sv]=Konfigurera inställningarna för skärmsläckaren.
-+Comment[zh_CN]=配置屏幕保护程序的设置。
-+Comment[zh_HK]=配置螢幕保護程式設定。
-+Comment[zh_TW]=配置螢幕保護程式設定。
- Type=Application
--Categories=Settings;DesktopSettings;Security;X-XFCE;
-+Categories=GNOME;Settings;Appearance;
-
--- a/components/desktop/xscreensaver/patches/04-solaris-paths.patch	Mon Mar 07 13:01:10 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,309 +0,0 @@
-Various fixes to deal with how & where we install things on Solaris:
-
-- Only run hacks from the hacks dir, not $PATH
-
-- Find helper programs even though they are not in $PATH
-
-- Show author names when reading RSS feeds from sites like blogs.sun.com
-
-- Show Solaris package names in demo app when hacks are not installed
-
-- Use gnome-help to display man pages nicely, without requiring internet
-  access (which some customers at secure sites won't have configured),
-  instead of opening a web browser to view the man page at jwz.org or
-  opening a gnome-terminal to run the man command.
-
-Mostly not acceptable upstream.
-
-Backport notes: this change relies on the gnome-help version delivered in
-Nevada that supports "man:xscreensaver" style URL's to display man pages.
-When backporting to older releases you will probably want to uncomment the
-lines shown for GNOME 2.4/2.6.
-
-Also, you'll need to fix the package names shown when the hacks are not
-installed to be the older SUNWxscreensaver-* for Solaris 10 & older.
----
- driver/Makefile.in              |    9 ++++--
- driver/XScreenSaver.ad.in       |   14 +++++++---
- driver/demo-Gtk.c               |    4 +-
- driver/subprocs.c               |   54 +++++++++++++++++++++++++++++++++++++-
- driver/xscreensaver-demo.glade2 |    8 +++--
- driver/xscreensaver-text        |    6 +++-
- driver/xscreensaver.man         |    5 +--
- hacks/glx/Makefile.in           |    4 +-
- 8 files changed, 84 insertions(+), 20 deletions(-)
-
-diff --git a/driver/Makefile.in b/driver/Makefile.in
---- a/driver/Makefile.in
-+++ b/driver/Makefile.in
[email protected]@ -27,7 +27,7 @@ INTLTOOL_MERGE	= @[email protected]
- GTK_DATADIR	= @[email protected]
- GTK_APPDIR	= $(GTK_DATADIR)/applications
- GTK_ICONDIR	= $(GTK_DATADIR)/pixmaps
--GTK_GLADEDIR	= $(GTK_DATADIR)/xscreensaver/glade
-+GTK_GLADEDIR	= $(prefix)/lib/xscreensaver/config
- HACK_CONF_DIR	= @[email protected]
- 
- CC		= @[email protected]
[email protected]@ -36,8 +36,11 @@ CFLAGS		= @[email protected]
- LDFLAGS		= @[email protected]
- DEFS		= @[email protected]
- INTL_DEFS	= -DLOCALEDIR=\"$(localedir)\"
--SUBP_DEFS	= $(DEFS) -DDEFAULT_PATH_PREFIX='"@[email protected]"'
--GTK_DEFS	= $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"'
-+SUBP_DEFS	= $(DEFS) -DHACK_PATH='"@[email protected]"' \
-+	-DDEFAULT_PATH_PREFIX='"@[email protected]:$(libexecdir)"' \
-+	-DHELPER_PATH='"$(libexecdir)"'
-+GTK_DEFS	= $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' \
-+			-DBINDIR='"$(bindir)"'
- CONF_DEFS	= -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"'
- 
- LIBS		= @[email protected]
-diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in
---- a/driver/XScreenSaver.ad.in
-+++ b/driver/XScreenSaver.ad.in
[email protected]@ -91,18 +91,24 @@ GetViewPortIsFullOfLies: False
- 
- ! This is the URL loaded by the "Help" button on the splash screen,
- ! and by the "Documentation" menu item in xscreensaver-demo.
--*helpURL: http://www.jwz.org/xscreensaver/man.html
-+*helpURL: man:xscreensaver
- 
- ! loadURL       -- how the "Help" buttons load the helpURL (/bin/sh syntax.)
- ! manualCommand -- how the "Documentation" buttons display man pages.
- !
- ! And there are so very many options to choose from!
- !
-+!   Modern GNOME:
-+!
-+*loadURL: gnome-help '%s'
-+*manualCommand: gnome-help 'man:%s'
-+!
- !   Gnome 2.4, 2.6: (yelp can't display man pages, as of 2.6.3)
- !
[email protected]@*loadURL: @[email protected] '%s'
[email protected]@*manualCommand: gnome-terminal --title '%s manual' \
[email protected]@		--command '/bin/sh -c "man %s; read foo"'
-+!*loadURL: gnome-terminal --title 'xscreensaver manual' \
-+!		--command '/bin/ksh -c "man xscreensaver; read foo"'
-+!*manualCommand: gnome-terminal --title '%s manual' \
-+!		--command '/bin/ksh -c "man %s; read foo"'
- !
- !   Gnome 2.2:
- !
-diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
---- a/driver/demo-Gtk.c
-+++ b/driver/demo-Gtk.c
[email protected]@ -991,7 +991,7 @@ restart_menu_cb (GtkWidget *widget, gpointer user_data)
-   flush_dialog_changes_and_save (s);
-   xscreensaver_command (GDK_DISPLAY(), XA_EXIT, 0, False, NULL);
-   sleep (1);
--  if (system ("xscreensaver -nosplash &") < 0)
-+  if (system (BINDIR "/xscreensaver -nosplash &") < 0)
-     fprintf (stderr, "%s: fork error\n", blurb());
- 
-   await_xscreensaver (s);
[email protected]@ -4951,7 +4951,7 @@ main (int argc, char **argv)
- 
-       if (init_results == 1)
- 	{
--	  system ("xscreensaver -nosplash &");
-+	  system (BINDIR "/xscreensaver -nosplash &");
- 	  return 0;
- 	}
- 
-diff --git a/driver/subprocs.c b/driver/subprocs.c
---- a/driver/subprocs.c
-+++ b/driver/subprocs.c
[email protected]@ -14,6 +14,7 @@
- # include "config.h"
- #endif
- 
-+#include <sys/stat.h>
- #include <ctype.h>
- #include <stdio.h>
- #include <string.h>
[email protected]@ -791,6 +792,8 @@ print_path_error (const char *program)
-   free (cmd);
-   perror (buf);
- 
-+/* mali - security issue do not want to display user's path */
-+#ifdef EXPOSE_USER_PATH
-   if (errno == ENOENT &&
-       (token = getenv("PATH")))
-     {
[email protected]@ -821,6 +824,7 @@ print_path_error (const char *program)
-         }
-       fprintf (stderr, "\n");
-     }
-+#endif
- }
- 
- 
[email protected]@ -877,12 +881,42 @@ fork_and_exec (saver_screen_info *ssi, const char *command)
-   return forked;
- }
- 
-+static Bool
-+check_if_hacks_dir_exists(Bool verbose_p)
-+{
-+  const char hackdir[] = HACK_PATH;
-+
-+  int status;
-+  struct stat st;
-+
-+  status = stat (hackdir, &st);
-+
-+  if (status == 0 && S_ISDIR(st.st_mode))
-+    {
-+      return True;
-+    }
-+   else
-+    {
-+      if (verbose_p)
-+       {
-+         fprintf(stderr,
-+                 "%s: Warning: dir: %s missing. Will not run hacks\n",
-+                 blurb(), hackdir);
-+       }
-+      return False;
-+    }
-+}
- 
- void
- spawn_screenhack (saver_screen_info *ssi)
- {
-   saver_info *si = ssi->global;
-   saver_preferences *p = &si->prefs;
-+  char* complete_hack_command;
-+
-+  if (si->prefs.verbose_p)
-+   fprintf(stderr, "--> spawn_screenhack()\n");
-+
-   XFlush (si->dpy);
- 
-   if (!monitor_powered_on_p (si))
[email protected]@ -962,6 +996,12 @@ spawn_screenhack (saver_screen_info *ssi)
- 	    ;
- 	}
- 
-+      if ((new_hack >= 0) &&
-+         (check_if_hacks_dir_exists(p->verbose_p) == False))
-+      {
-+         new_hack = -1;
-+      }
-+
-       if (new_hack < 0)   /* don't run a hack */
-         {
-           ssi->current_hack = -1;
[email protected]@ -1009,7 +1049,17 @@ spawn_screenhack (saver_screen_info *ssi)
-       if (si->selection_mode < 0)
- 	si->selection_mode = 0;
- 
--      forked = fork_and_exec (ssi, hack->command);
-+      /* We need complete path to hack command else any executable
-+       * with the same name in the path gets executed.
-+       */
-+      complete_hack_command = malloc (10 + strlen(hack->command) +
-+                                             strlen (HACK_PATH));
-+      sprintf(complete_hack_command, HACK_PATH"/%s", hack->command);
-+
-+
-+      forked = fork_and_exec (ssi, complete_hack_command);
-+      free (complete_hack_command);
-+
-       switch ((int) forked)
- 	{
- 	case -1: /* fork failed */
[email protected]@ -1186,7 +1236,7 @@ get_best_gl_visual (saver_info *si, Screen *screen)
-   char *av[10];
-   int ac = 0;
- 
--  av[ac++] = "xscreensaver-gl-helper";
-+  av[ac++] = HELPER_PATH "/xscreensaver-gl-helper";
-   av[ac] = 0;
- 
-   if (pipe (fds))
-diff --git a/driver/xscreensaver-demo.glade2 b/driver/xscreensaver-demo.glade2
---- a/driver/xscreensaver-demo.glade2
-+++ b/driver/xscreensaver-demo.glade2
[email protected]@ -927,6 +927,6 @@ Installed</property>
- 			      <property name="visible">True</property>
- 			      <property name="label" translatable="yes">Very few (or no) screen savers appear to be available.
- 
--This probably means that the &quot;xscreensaver-extras&quot; and
--&quot;xscreensaver-gl-extras&quot; packages are not installed.</property>
-+This probably means that the “desktop/xscreensaver/hacks” and
-+“desktop/xscreensaver/hacks/hacks-gl” packages are not installed.</property>
- 			      <property name="use_underline">False</property>
-			      <property name="use_markup">False</property>
- 			      <property name="justify">GTK_JUSTIFY_CENTER</property>
-diff --git a/driver/xscreensaver-text b/driver/xscreensaver-text
---- a/driver/xscreensaver-text
-+++ b/driver/xscreensaver-text
[email protected]@ -698,12 +698,15 @@ sub reformat_rss($) {
-     $i++;
- 
-     my ($title, $body1, $body2, $body3);
-+    my $author;
-     
-     $title = $3 if ([email protected]<((TITLE)       [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
-     $body1 = $3 if ([email protected]<((DESCRIPTION) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
-     $body2 = $3 if ([email protected]<((CONTENT)     [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
-     $body3 = $3 if ([email protected]<((SUMMARY)     [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
- 
-+    $author = $3 if ([email protected]<((DC:CREATOR) [^<>\s]*)[^<>]*>\s*(.*?)\s*</\1>@xsi);
-+
-     # If there are both <description> and <content> or <content:encoded>,
-     # use whichever one contains more text.
-     #
[email protected]@ -727,10 +730,11 @@ sub reformat_rss($) {
- 
-     $title = rss_field_to_html ($title || '');
-     $body1 = rss_field_to_html ($body1 || '');
-+    $author = rss_field_to_html ($author || '');
- 
-     $title = '' if ($body1 eq $title);  # Identical in Twitter's atom feed.
- 
--    reformat_html ("$title<P>$body1", 1);
-+    reformat_html ("$title<BR>$author<P>$body1", 1);
-     print "\n";
-   }
- }
-diff --git a/driver/xscreensaver.man b/driver/xscreensaver.man
---- a/driver/xscreensaver.man
-+++ b/driver/xscreensaver.man
[email protected]@ -97,9 +97,8 @@ xscreensaver-command -restart
- If you want to set the system-wide defaults, then make your edits to
- the xscreensaver app-defaults file, which should have been installed
- when xscreensaver itself was installed.  The app-defaults file will
--usually be named /usr/lib/X11/app-defaults/XScreenSaver, but different
--systems might keep it in a different place (for example,
--/usr/openwin/lib/app-defaults/XScreenSaver on Solaris.)
-+usually be named /usr/share/X11/app-defaults/XScreenSaver, but different
-+systems might keep it in a different place.
- 
- When settings are changed in the Preferences dialog box (see above)
- the current settings will be written to the \fI.xscreensaver\fP file.
-diff --git a/hacks/glx/Makefile.in b/hacks/glx/Makefile.in
---- a/hacks/glx/Makefile.in
-+++ b/hacks/glx/Makefile.in
[email protected]@ -278,7 +278,7 @@ install-program:: $(EXES)
- # the xscreensaver-gl-helper program, in $bindir
- install-program:: $(EXES)
- 	@exes="@[email protected]" ;					\
--	 idir="$(install_prefix)$(bindir)" ;				\
-+	 idir="$(install_prefix)$(libexecdir)" ;			\
- 	 if [ "$$exes" != "" ]; then					\
- 	   if [ ! -d $$idir ]; then					\
- 	     $(INSTALL_DIRS) $$idir ;					\
[email protected]@ -347,7 +347,7 @@ uninstall-program::
- # the xscreensaver-gl-helper program, in $bindir
- uninstall-program::
- 	@exes="$(GL_UTIL_EXES)" ;					\
--	 idir="$(install_prefix)$(bindir)" ;				\
-+	 idir="$(install_prefix)$(libexecdir)" ;			\
- 	 for program in $$exes; do					\
- 	   echo rm -f $$idir/$$program ;				\
- 		rm -f $$idir/$$program ;				\
-
--- a/components/desktop/xscreensaver/patches/05-atoms.patch	Mon Mar 07 13:01:10 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,498 +0,0 @@
-Centralize atom handling and use XInternAtoms to get the atoms from
-the server in one round trip instead of a separate synchronous/blocking
-round trip for each XInternAtom individual call.
-
-Was offered upstream in 2011 - jwz responded with:
-  I'd sure like to see some kind of performance metrics -- like, any -- before
-  making a big change to something so central. When it comes to the xscreensaver
-  driver I'm a firm believer in "don't fix what ain't broke"...
-
-Need to find some time to actually measure that someday (dtrace?).
-
----
- driver/Makefile.in            |   14 +++---
- driver/atoms.c                |  113 +++++++++++++++++++++++++++++++++++++++++
- driver/atoms.h                |   33 ++++++++++++
- driver/demo-Gtk.c             |   26 ++-------
- driver/demo-Xm.c              |   25 ++-------
- driver/remote.c               |    4 +-
- driver/windows.c              |    4 +-
- driver/xscreensaver-command.c |   35 ++-----------
- driver/xscreensaver.c         |   45 ++++++-----------
- driver/xscreensaver.h         |    3 -
- 10 files changed, 188 insertions(+), 114 deletions(-)
- create mode 100644 driver/atoms.c
- create mode 100644 driver/atoms.h
-
-diff --git a/driver/Makefile.in b/driver/Makefile.in
---- a/driver/Makefile.in
-+++ b/driver/Makefile.in
[email protected]@ -190,18 +190,18 @@ SAVER_OBJS_1	= xscreensaver.o windows.o screens.o timers.o subprocs.o \
- 		  exec.o xset.o splash.o setuid.o stderr.o mlstring.o
- 
- SAVER_SRCS	= $(SAVER_SRCS_1) prefs.c dpms.c $(LOCK_SRCS) \
--		  $(SAVER_UTIL_SRCS) $(GL_SRCS)
-+		  $(SAVER_UTIL_SRCS) $(GL_SRCS) atoms.c
- SAVER_OBJS	= $(SAVER_OBJS_1) prefs.o dpms.o $(LOCK_OBJS) \
--		  $(SAVER_UTIL_OBJS) $(GL_OBJS)
-+		  $(SAVER_UTIL_OBJS) $(GL_OBJS) atoms.o
- 
--CMD_SRCS	= remote.c xscreensaver-command.c
--CMD_OBJS	= remote.o xscreensaver-command.o
-+CMD_SRCS	= remote.c atoms.c xscreensaver-command.c
-+CMD_OBJS	= remote.o atoms.o xscreensaver-command.o
- 
- DEMO_SRCS_1	= prefs.c dpms.c
- DEMO_OBJS_1	= prefs.o dpms.o
- 
--DEMO_SRCS	= $(DEMO_SRCS_1) remote.c exec.c $(DEMO_UTIL_SRCS)
--DEMO_OBJS	= $(DEMO_OBJS_1) remote.o exec.o $(DEMO_UTIL_OBJS)
-+DEMO_SRCS	= $(DEMO_SRCS_1) remote.c atoms.c exec.c $(DEMO_UTIL_SRCS)
-+DEMO_OBJS	= $(DEMO_OBJS_1) remote.o atoms.o exec.o $(DEMO_UTIL_OBJS)
- 
- PDF2JPEG_SRCS	= pdf2jpeg.m
- PDF2JPEG_OBJS	= pdf2jpeg.o
[email protected]@ -231,7 +231,7 @@ SCRIPTS		= $(SCRIPTS_1) @[email protected]
- HDRS		= XScreenSaver_ad.h XScreenSaver_Xm_ad.h \
- 		  xscreensaver.h prefs.h remote.h exec.h \
- 		  demo-Gtk-widgets.h demo-Gtk-stubs.h demo-Gtk-support.h \
--		  demo-Gtk-conf.h auth.h mlstring.h types.h
-+		  demo-Gtk-conf.h auth.h mlstring.h types.h atoms.h
- MEN_1		= xscreensaver.man xscreensaver-demo.man \
- 		  xscreensaver-command.man \
- 		  xscreensaver-text.man \
-diff --git a/driver/atoms.c b/driver/atoms.c
-new file mode 100644
---- /dev/null
-+++ b/driver/atoms.c
[email protected]@ -0,0 +1,113 @@
-+/* xscreensaver, Copyright (c) 1991-2010 Jamie Zawinski <[email protected]>
-+ *
-+ * Permission to use, copy, modify, distribute, and sell this software and its
-+ * documentation for any purpose is hereby granted without fee, provided that
-+ * the above copyright notice appear in all copies and that both that
-+ * copyright notice and this permission notice appear in supporting
-+ * documentation.  No representations are made about the suitability of this
-+ * software for any purpose.  It is provided "as is" without express or
-+ * implied warranty.
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+# include "config.h"
-+#endif
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <sys/types.h>
-+
-+#include <X11/Xproto.h>		/* for CARD32 */
-+#include <X11/Xlib.h>
-+#include <X11/Xos.h>
-+
-+#include "atoms.h"
-+
-+/* Atoms to retrieve info from remote daemon */
-+Atom XA_SCREENSAVER, XA_SCREENSAVER_ID, XA_SCREENSAVER_VERSION,
-+   XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_STATUS;
-+
-+/* Atoms to send commands to remote daemon */
-+Atom XA_ACTIVATE, XA_BLANK, XA_CYCLE, XA_DEACTIVATE, XA_DEMO,
-+  XA_EXIT, XA_LOCK, XA_NEXT, XA_PREFS, XA_PREV, XA_RESTART,
-+  XA_SELECT, XA_THROTTLE, XA_UNTHROTTLE;
-+
-+static const struct atom_request remote_control_atom_list[] =
-+{
-+    { &XA_SCREENSAVER, "SCREENSAVER" },
-+    { &XA_SCREENSAVER_ID, "_SCREENSAVER_ID" },
-+    { &XA_SCREENSAVER_VERSION, "_SCREENSAVER_VERSION" },
-+    { &XA_SCREENSAVER_RESPONSE, "_SCREENSAVER_RESPONSE" },
-+    { &XA_SCREENSAVER_STATUS, "_SCREENSAVER_STATUS" },
-+    { &XA_ACTIVATE, "ACTIVATE" },
-+    { &XA_BLANK, "BLANK" },
-+    { &XA_CYCLE, "CYCLE" },
-+    { &XA_DEACTIVATE, "DEACTIVATE" },
-+    { &XA_DEMO, "DEMO" },
-+    { &XA_EXIT, "EXIT" },
-+    { &XA_LOCK, "LOCK" },
-+    { &XA_NEXT, "NEXT" },
-+    { &XA_PREFS, "PREFS" },
-+    { &XA_PREV, "PREV" },
-+    { &XA_RESTART, "RESTART" },
-+    { &XA_SELECT, "SELECT" },
-+    { &XA_THROTTLE, "THROTTLE" },
-+    { &XA_UNTHROTTLE, "UNTHROTTLE" },
-+    { NULL, NULL } /* Must be last to terminate list */
-+};
-+
-+const struct atom_request *remote_control_atoms = remote_control_atom_list;
-+
-+/* Load a list of atoms in a single round trip to the X server instead of
-+   waiting for a synchronous round trip for each and every atom */
-+Status request_atoms ( Display *dpy,
-+		       const struct atom_request **request_lists )
-+{
-+  int atom_count, n;
-+  Status result;
-+  const struct atom_request **l, *r;
-+  Atom *atoms;
-+  const char **names;
-+
-+  /* Count the number of items across all the lists passed in */
-+  atom_count = 0;
-+  for (l = request_lists; l != NULL && *l != NULL; l++)
-+    {
-+      for (r = *l; r != NULL && r->name != NULL; r++)
-+	{
-+	  atom_count++;
-+	}
-+    }
-+
-+  atoms = calloc(atom_count, sizeof(Atom));
-+  names = calloc(atom_count, sizeof(char *));
-+  if (!atoms || !names)
-+    return -1;
-+
-+  n = 0;
-+  for (l = request_lists; l != NULL && *l != NULL; l++)
-+    {
-+      for (r = *l; r != NULL && r->name != NULL; r++)
-+	{
-+	  names[n++] = r->name;
-+	}
-+    }
-+  result = XInternAtoms( dpy, (char **) names, atom_count, False, atoms );
-+
-+  n = 0;
-+  for (l = request_lists; l != NULL && *l != NULL; l++)
-+    {
-+      for (r = *l; r != NULL && r->name != NULL; r++)
-+	{
-+#if DEBUG_ATOMS
-+	  fprintf (stderr, "atom: %s => %d\n", names[n], atoms[n]);
-+#endif
-+	  *(r->atomp) = atoms[n++];
-+	}
-+    }
-+
-+  free(atoms);
-+  free(names);
-+
-+  return result;
-+}
-diff --git a/driver/atoms.h b/driver/atoms.h
-new file mode 100644
---- /dev/null
-+++ b/driver/atoms.h
[email protected]@ -0,0 +1,33 @@
-+/* xscreensaver, Copyright (c) 1991-2010 Jamie Zawinski <[email protected]>
-+ *
-+ * Permission to use, copy, modify, distribute, and sell this software and its
-+ * documentation for any purpose is hereby granted without fee, provided that
-+ * the above copyright notice appear in all copies and that both that
-+ * copyright notice and this permission notice appear in supporting
-+ * documentation.  No representations are made about the suitability of this
-+ * software for any purpose.  It is provided "as is" without express or
-+ * implied warranty.
-+ */
-+
-+#ifndef _XSCREENSAVER_ATOMS_H_
-+#define _XSCREENSAVER_ATOMS_H_
-+
-+struct atom_request {
-+    Atom *atomp;
-+    const char *name;
-+};
-+
-+extern const struct atom_request *remote_control_atoms;
-+extern Status request_atoms ( Display *dpy,
-+			      const struct atom_request **request_lists );
-+
-+/* Atoms to retrieve info from remote daemon */
-+extern Atom XA_SCREENSAVER, XA_SCREENSAVER_ID, XA_SCREENSAVER_VERSION,
-+  XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_STATUS;
-+
-+/* Atoms to send commands to remote daemon */
-+extern Atom XA_ACTIVATE, XA_BLANK, XA_CYCLE, XA_DEACTIVATE, XA_DEMO,
-+  XA_EXIT, XA_LOCK, XA_NEXT, XA_PREFS, XA_PREV, XA_RESTART,
-+  XA_SELECT, XA_THROTTLE, XA_UNTHROTTLE;
-+
-+#endif /* _XSCREENSAVER_ATOMS_H_ */
-diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c
---- a/driver/demo-Gtk.c
-+++ b/driver/demo-Gtk.c
[email protected]@ -118,6 +118,7 @@
- #include "resources.h"		/* for parse_time() */
- #include "visual.h"		/* for has_writable_cells() */
- #include "remote.h"		/* for xscreensaver_command() */
-+#include "atoms.h"
- #include "usleep.h"
- 
- #include "logo-50.xpm"
[email protected]@ -252,12 +253,6 @@ typedef struct {
-    a closure object of our own down into the various widget callbacks. */
- static state *global_state_kludge;
- 
--Atom XA_VROOT;
--Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION;
--Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO;
--Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT;
--
--
- static void populate_demo_window (state *, int list_elt);
- static void populate_prefs_page (state *);
- static void populate_popup_window (state *);
[email protected]@ -5050,20 +5045,11 @@ main (int argc, char **argv)
- 
-   /* Intern the atoms that xscreensaver_command() needs.
-    */
--  XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
--  XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
--  XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
--  XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
--  XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
--  XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
--  XA_SELECT = XInternAtom (dpy, "SELECT", False);
--  XA_DEMO = XInternAtom (dpy, "DEMO", False);
--  XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
--  XA_BLANK = XInternAtom (dpy, "BLANK", False);
--  XA_LOCK = XInternAtom (dpy, "LOCK", False);
--  XA_EXIT = XInternAtom (dpy, "EXIT", False);
--  XA_RESTART = XInternAtom (dpy, "RESTART", False);
--
-+  {
-+    const struct atom_request *atom_lists[2] = { NULL, NULL };
-+    atom_lists[0] = remote_control_atoms;
-+    request_atoms (dpy, atom_lists);
-+  }
- 
-   /* Create the window and all its widgets.
-    */
-diff --git a/driver/demo-Xm.c b/driver/demo-Xm.c
---- a/driver/demo-Xm.c
-+++ b/driver/demo-Xm.c
[email protected]@ -82,6 +82,7 @@
- #include "resources.h"		/* for parse_time() */
- #include "visual.h"		/* for has_writable_cells() */
- #include "remote.h"		/* for xscreensaver_command() */
-+#include "atoms.h"
- #include "usleep.h"
- 
- #include <stdio.h>
[email protected]@ -110,12 +111,6 @@ extern const char *visual_menu[];
- 
- static char *short_version = 0;
- 
--Atom XA_VROOT;
--Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION;
--Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO;
--Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT;
--
--
- static void populate_demo_window (Widget toplevel,
-                                   int which, prefs_pair *pair);
- static void populate_prefs_page (Widget top, prefs_pair *pair);
[email protected]@ -1791,19 +1786,11 @@ main (int argc, char **argv)
- 
-   /* Intern the atoms that xscreensaver_command() needs.
-    */
--  XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
--  XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
--  XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
--  XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
--  XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
--  XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
--  XA_SELECT = XInternAtom (dpy, "SELECT", False);
--  XA_DEMO = XInternAtom (dpy, "DEMO", False);
--  XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
--  XA_BLANK = XInternAtom (dpy, "BLANK", False);
--  XA_LOCK = XInternAtom (dpy, "LOCK", False);
--  XA_EXIT = XInternAtom (dpy, "EXIT", False);
--  XA_RESTART = XInternAtom (dpy, "RESTART", False);
-+  {
-+    const struct atom_request *atom_lists[2] = { NULL, NULL };
-+    atom_lists[0] = remote_control_atoms;
-+    request_atoms (dpy, atom_lists);
-+  }
- 
-   /* Create the window and all its widgets.
-    */
-diff --git a/driver/remote.c b/driver/remote.c
---- a/driver/remote.c
-+++ b/driver/remote.c
[email protected]@ -34,15 +34,13 @@
- #include <X11/Xos.h>
- 
- #include "remote.h"
-+#include "atoms.h"
- 
- #ifdef _VROOT_H_
- ERROR! you must not include vroot.h in this file
- #endif
- 
- extern char *progname;
--extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE;
--extern Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_EXIT;
--extern Atom XA_VROOT, XA_SELECT, XA_DEMO, XA_BLANK, XA_LOCK;
- 
- 
- static XErrorHandler old_handler = 0;
-diff --git a/driver/windows.c b/driver/windows.c
---- a/driver/windows.c
-+++ b/driver/windows.c
[email protected]@ -69,14 +69,12 @@ typedef long PROP32;
- #include "xscreensaver.h"
- #include "visual.h"
- #include "fade.h"
-+#include "atoms.h"
- 
- 
- extern int kill (pid_t, int);		/* signal() is in sys/signal.h... */
- 
- Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
--Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
--Atom XA_SCREENSAVER_STATUS;
--
- 
- extern saver_info *global_si_kludge;	/* I hate C so much... */
- 
-diff --git a/driver/xscreensaver-command.c b/driver/xscreensaver-command.c
---- a/driver/xscreensaver-command.c
-+++ b/driver/xscreensaver-command.c
[email protected]@ -40,6 +40,7 @@
- typedef long PROP32;
- 
- #include "remote.h"
-+#include "atoms.h"
- #include "version.h"
- 
- #ifdef _VROOT_H_
[email protected]@ -48,13 +49,6 @@ ERROR! you must not include vroot.h in this file
- 
- char *progname;
- 
--Atom XA_VROOT;
--Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE;
--Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO, XA_EXIT;
--Atom XA_BLANK, XA_LOCK;
--static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV;
--static Atom XA_RESTART, XA_PREFS, XA_THROTTLE, XA_UNTHROTTLE;
--
- static char *screensaver_version;
- # ifdef __GNUC__
-   __extension__   /* don't warn about "string length is greater than the
[email protected]@ -285,28 +279,11 @@ main (int argc, char **argv)
-       exit (1);
-     }
- 
--  XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False);
--  XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False);
--  XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False);
--  XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False);
--  XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False);
--  XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False);
--  XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False);
--  XA_DEACTIVATE = XInternAtom (dpy, "DEACTIVATE", False);
--  XA_RESTART = XInternAtom (dpy, "RESTART", False);
--  XA_CYCLE = XInternAtom (dpy, "CYCLE", False);
--  XA_NEXT = XInternAtom (dpy, "NEXT", False);
--  XA_PREV = XInternAtom (dpy, "PREV", False);
--  XA_SELECT = XInternAtom (dpy, "SELECT", False);
--  XA_EXIT = XInternAtom (dpy, "EXIT", False);
--  XA_DEMO = XInternAtom (dpy, "DEMO", False);
--  XA_PREFS = XInternAtom (dpy, "PREFS", False);
--  XA_LOCK = XInternAtom (dpy, "LOCK", False);
--  XA_BLANK = XInternAtom (dpy, "BLANK", False);
--  XA_THROTTLE = XInternAtom (dpy, "THROTTLE", False);
--  XA_UNTHROTTLE = XInternAtom (dpy, "UNTHROTTLE", False);
--
--  XSync (dpy, 0);
-+  {
-+    const struct atom_request *atom_lists[2] = { NULL, NULL };
-+    atom_lists[0] = remote_control_atoms;
-+    request_atoms (dpy, atom_lists);
-+  }
- 
-   if (cmd == &XA_WATCH)
-     {
-diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c
---- a/driver/xscreensaver.c
-+++ b/driver/xscreensaver.c
[email protected]@ -224,6 +224,7 @@
- #include "visual.h"
- #include "usleep.h"
- #include "auth.h"
-+#include "atoms.h"
- 
- saver_info *global_si_kludge = 0;	/* I hate C so much... */
- 
[email protected]@ -232,12 +233,6 @@ char *progclass = 0;
- XrmDatabase db = 0;
- 
- 
--static Atom XA_SCREENSAVER_RESPONSE;
--static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV;
--static Atom XA_RESTART, XA_SELECT;
--static Atom XA_THROTTLE, XA_UNTHROTTLE;
--Atom XA_DEMO, XA_PREFS, XA_EXIT, XA_LOCK, XA_BLANK;
--
- 
- static XrmOptionDescRec options [] = {
- 
[email protected]@ -628,30 +623,20 @@ connect_to_server (saver_info *si, int *argc, char **argv)
- 
-   db = si->prefs.db;	/* resources.c needs this */
- 
--  XA_VROOT = XInternAtom (si->dpy, "__SWM_VROOT", False);
--  XA_SCREENSAVER = XInternAtom (si->dpy, "SCREENSAVER", False);
--  XA_SCREENSAVER_VERSION = XInternAtom (si->dpy, "_SCREENSAVER_VERSION",False);
--  XA_SCREENSAVER_ID = XInternAtom (si->dpy, "_SCREENSAVER_ID", False);
--  XA_SCREENSAVER_STATUS = XInternAtom (si->dpy, "_SCREENSAVER_STATUS", False);
--  XA_SCREENSAVER_RESPONSE = XInternAtom (si->dpy, "_SCREENSAVER_RESPONSE",
--					 False);
--  XA_XSETROOT_ID = XInternAtom (si->dpy, "_XSETROOT_ID", False);
--  XA_ESETROOT_PMAP_ID = XInternAtom (si->dpy, "ESETROOT_PMAP_ID", False);
--  XA_XROOTPMAP_ID = XInternAtom (si->dpy, "_XROOTPMAP_ID", False);
--  XA_ACTIVATE = XInternAtom (si->dpy, "ACTIVATE", False);
--  XA_DEACTIVATE = XInternAtom (si->dpy, "DEACTIVATE", False);
--  XA_RESTART = XInternAtom (si->dpy, "RESTART", False);
--  XA_CYCLE = XInternAtom (si->dpy, "CYCLE", False);
--  XA_NEXT = XInternAtom (si->dpy, "NEXT", False);
--  XA_PREV = XInternAtom (si->dpy, "PREV", False);
--  XA_SELECT = XInternAtom (si->dpy, "SELECT", False);
--  XA_EXIT = XInternAtom (si->dpy, "EXIT", False);
--  XA_DEMO = XInternAtom (si->dpy, "DEMO", False);
--  XA_PREFS = XInternAtom (si->dpy, "PREFS", False);
--  XA_LOCK = XInternAtom (si->dpy, "LOCK", False);
--  XA_BLANK = XInternAtom (si->dpy, "BLANK", False);
--  XA_THROTTLE = XInternAtom (si->dpy, "THROTTLE", False);
--  XA_UNTHROTTLE = XInternAtom (si->dpy, "UNTHROTTLE", False);
-+  {
-+    const struct atom_request root_atoms[] =
-+      {
-+	{ &XA_VROOT, "__SWM_VROOT" },
-+	{ &XA_XSETROOT_ID, "_XSETROOT_ID" },
-+	{ &XA_ESETROOT_PMAP_ID, "ESETROOT_PMAP_ID" },
-+	{ &XA_XROOTPMAP_ID, "_XROOTPMAP_ID" },
-+	{ NULL, NULL } /* Must be last to terminate list */
-+      };
-+    const struct atom_request *atom_lists[3] = { NULL, NULL, NULL };
-+    atom_lists[0] = remote_control_atoms;
-+    atom_lists[1] = root_atoms;
-+    request_atoms (si->dpy, atom_lists);
-+  }
- 
-   return toplevel_shell;
- }
-diff --git a/driver/xscreensaver.h b/driver/xscreensaver.h
---- a/driver/xscreensaver.h
-+++ b/driver/xscreensaver.h
[email protected]@ -200,8 +200,5 @@ Bool safe_XF86VidModeGetViewPort (Display *, int, int *, int *);
- #endif /* HAVE_XF86VMODE */
- 
- extern Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
--extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
--extern Atom XA_SCREENSAVER_STATUS, XA_LOCK, XA_BLANK;
--extern Atom XA_DEMO, XA_PREFS;
- 
- #endif /* __XSCREENSAVER_H__ */
-
--- a/components/desktop/xscreensaver/patches/06-gtk-lock.patch	Mon Mar 07 13:01:10 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3976 +0,0 @@
-Solaris uses the gtk unlock dialog program originally written by
-Ximian & Wipro, in order to provide a dialog box that works with
-the GNOME accessibility framework.   This was done as a fork of
-the original xscreensaver because the maintainer would not allow
-use of a toolkit in the lock dialog - he has since softened his
-stance a bit, but this has not been presented to him to see if it
-meets his requirements as spelled out at:
-        http://www.jwz.org/xscreensaver/toolkits.html
-
-This patch also contains fixes for:
-
-15134570 SUNBT4782515 user is prompted to enter PIN or password when screen
-	 	      is locked
-15134983 SUNBT4783832 No date on xscreensaver-lock and warning on screen
-15179562 SUNBT4931584 xscreensaver-demo cores with GTK_MODULES=gail:atk-bridge
-15209082 SUNBT5039876 "User:" should not look like an input field
-15209083 SUNBT5039878 "Password:" field should be focused / have flashing caret
-15214348 SUNBT5059445 pam service name, screen kb and screen reader support
-15220008 SUNBT5077989 Bug 147580: password input dialogue obscures GOK
-15220010 SUNBT5077993 Bug 147639: Gok cant automatically UI grab screensaver
-	 	      preferences
-15220705 SUNBT5079870 147587: password field should set ATK_ROLE_PASSWORD_TEXT
-15221761 SUNBT5083155 Unable to unlock screen when running dual head
-	 	      magnification
-15231258 SUNBT6176524 passwdTimeoutEnable for disabled user (xscreensaver-lock)
-15231818 SUNBT6178584 Xscreensaver needs to use ROLE_PASSWORD_TEXT
-15233078 SUNBT6182506 Screensaver dialog isn't magnified properly
-15239418 SUNBT6203951 xscreensaver lockscreen translation errors for fr_FR
-15252945 SUNBT6237901 Ldap and Gnome xscreensaver authentication failure
-15265442 SUNBT6269444 snv_14 xscreensaver prints out gratuitous debug messages
-	 	      after authentication
-15280862 SUNBT6308859 xscreensaver: password lock dialog is not localized
-15295912 SUNBT6346056 xscreensaver should not enable input method
-15317555 SUNBT6395649 at-spi-registryd starts when screen is locked even when
-	 	      accessible device support is off
-15326852 SUNBT6417168 xscreensaver loops while trying to unlock a session for
-	 	      a user whose password was expired
-15346556 SUNBT6461887 GNOME screen lock does not prevent access to other
-	 	      applications via 'alt-tab'
-15352585 SUNBT6475285 xscreensaver core dumps in kill_job() after unlocking
-	 	      the screen
-15354012 SUNBT6478362 When the AT support is enabled, the input focus is
-	 	      located at password label
-15356879 SUNBT6484604 X should stop linking against -lcmd
-15375976 SUNBT6520014 possible mem. leak in xscreensaver's lock.c in s11/nv
-15387793 SUNBT6541240 Screen saver will lock user out of the system if they
-	 	      have no password set
-15405753 SUNBT6573182 after applying patch 120094-11(or later), xscreensaver
-	 	      core dump
-15427168 SUNBT6611183 xscreensaver needs to put Sun logos in files loaded at
-	 	      runtime
-15461985 SUNBT6670025 xscreensaver passwd dialog image missing in nv_85
-15462355 SUNBT6670659 password dialog window remains on the screen even after
-	 	      screen is unlocked
-15463666 SUNBT6673036 prepare for Indiana unlock logos
-15500787 SUNBT6736157 Security problem when desktop a11y support is turned on
-15521700 SUNBT6769901 popup windows appearing through xscreensaver
-15553552 SUNBT6825374 xscreensaver issues under Xorg
-15561643 SUNBT6839026 Regression in screensaver may cause Performance
-	 	      Degradation and make locked screensaver unresponsive
-15565807 SUNBT6845751 xscreensaver-lock chews CPU when daemon dies while unlock
-	 	      dialog is up
-15568147 SUNBT6849124 xscreensaver leaves a dialog that cannot be moved/closed
-	 	      after password change warning
-15573881 SUNBT6857559 Nevada build was broken because of 6849124
----
- config.h.in           |    3 +
- configure.in          |   23 +-
- driver/Makefile.in    |   59 +++-
- driver/auth.h         |    4 +
- driver/demo-Gtk.c     |   18 +
- driver/dialog-data.h  |  131 ++++++
- driver/lock-Gtk.c     |  955 +++++++++++++++++++++++++++++++++++++++++++
- driver/lock.c         | 1083 ++++++++++++++++++++++++++++++++++++++++++++-----
- driver/passwd-pam.c   |  207 +++++++++-
- driver/passwd.c       |    1 +
- driver/setuid.c       |    5 +-
- driver/subprocs.c     |   35 ++-
- driver/timers.c       |  110 +++++-
- driver/types.h        |   18 +
- driver/windows.c      |   21 +-
- driver/xscreensaver.c |  131 ++++++-
- driver/xscreensaver.h |    6 +
- 17 files changed, 2663 insertions(+), 147 deletions(-)
- create mode 100644 driver/dialog-data.h
- create mode 100644 driver/lock-Gtk.c
-
-diff --git a/config.h.in b/config.h.in
---- a/config.h.in
-+++ b/config.h.in
[email protected]@ -384,6 +384,9 @@
-    make use of this if it is available. */
- #undef HAVE_XPM
- 
-+/* Define this to build the external lock dialog */
-+#undef HAVE_XSCREENSAVER_LOCK
-+
- /* Define this if you have the X Shared Memory Extension. */
- #undef HAVE_XSHM_EXTENSION
- 
-diff --git a/configure.in b/configure.in
---- a/configure.in
-+++ b/configure.in
[email protected]@ -2531,6 +2531,8 @@ if test "$with_gtk" = yes; then
-   pkg_check_version        libglade-2.0  1.99.0
-   pkg_check_version      gdk-pixbuf-2.0  2.0.0
-   pkg_check_version gdk-pixbuf-xlib-2.0  2.0.0
-+  pkg_check_version           gconf-2.0  2.6.1
-+  pkg_check_version  libloginhelper-1.0  1.0
-   have_gtk="$ok"
- 
-   if test "$have_gtk" = no; then
[email protected]@ -2546,6 +2548,9 @@ if test "$with_gtk" = yes; then
-   fi
- 
-   if test "$have_gtk" = yes; then
-+#--- Begin SUNW addition
-+    AC_DEFINE(HAVE_XSCREENSAVER_LOCK,[],[Define this to build the external lock dialog])
-+#--- End SUNW addition
-     AC_CACHE_CHECK([for Gtk includes], ac_cv_gtk_config_cflags,
-                    [ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`])
-     AC_CACHE_CHECK([for Gtk libs], ac_cv_gtk_config_libs,
[email protected]@ -3642,6 +3647,16 @@ if test "$have_gtk" = yes; then
-   ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
- fi
- 
-+#--- Begin SUNW addition
-+PREFERRED_LOCK_PROGRAM=
-+ALL_LOCK_PROGRAMS=
-+LOCK_PROGRAM=
-+if test "$have_gtk" = yes; then
-+  PREFERRED_LOCK_PROGRAM=xscreensaver-lock-Gtk
-+  ALL_LOCK_PROGRAMS="$PREFERRED_LOCK_PROGRAM $ALL_LOCK_PROGRAMS"
-+  LOCK_PROGRAM=xscreensaver-lock
-+fi
-+#--- End SUNW addition
- 
- if test "$have_kerberos" = yes; then
-   PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)"