--- data/gnome-power-manager.schemas.in.orig	2008-02-04 10:12:40.941327000 +0800
+++ data/gnome-power-manager.schemas.in	2008-02-04 10:24:07.361341000 +0800
@@ -929,6 +929,18 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/gnome-power-manager/ui/enable_screen_lock</key>
+      <applyto>/apps/gnome-power-manager/ui/enable_screen_lock</applyto>
+      <owner>gnome-power-manager</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>If screen lock should be used</short>
+        <long>If screen lock should be used when lid is closed, or system performs a suspend or hibernate action.</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/gnome-power-manager/ui/show_actions_in_menu</key>
       <applyto>/apps/gnome-power-manager/ui/show_actions_in_menu</applyto>
       <owner>gnome-power-manager</owner>
--- src/gpm-control.c.orig	2007-07-27 07:28:18.000000000 +0800
+++ src/gpm-control.c	2008-02-13 13:06:29.259536000 +0800
@@ -377,6 +377,10 @@
 {
 	gboolean do_lock;
 	gboolean use_ss_setting;
+#if defined(sun) && defined(__SVR4)
+	gpm_conf_get_bool (control->priv->conf, GPM_CONF_UI_ENABLE_SCREEN_LOCK, &do_lock);
+	egg_debug ("Using custom locking settings (%i)", do_lock);
+#else
 	/* This allows us to over-ride the custom lock settings set in gconf
 	   with a system default set in gnome-screensaver.
 	   See bug #331164 for all the juicy details. :-) */
@@ -388,6 +392,7 @@
 		gpm_conf_get_bool (control->priv->conf, policy, &do_lock);
 		egg_debug ("Using custom locking settings (%i)", do_lock);
 	}
+#endif
 	return do_lock;
 }
 
--- src/gpm-conf.h.orig	2008-02-18 16:47:20.806807000 +0800
+++ src/gpm-conf.h	2008-02-18 16:48:11.849112000 +0800
@@ -148,6 +148,7 @@
 #define GPM_CONF_UI_SHOW_ACTIONS_IN_MENU	GPM_CONF_DIR "/ui/show_actions_in_menu"
 #define GPM_CONF_UI_ENABLE_BEEPING		GPM_CONF_DIR "/ui/enable_sound"
 #define GPM_CONF_UI_SHOW_CONTEXT_MENU		GPM_CONF_DIR "/ui/show_context_menu"
+#define GPM_CONF_UI_ENABLE_SCREEN_LOCK		GPM_CONF_DIR "/ui/enable_screen_lock"
 
 /* we use the gnome-session key now */
 #define GPM_CONF_SESSION_REQUEST_SAVE		"/apps/gnome-session/options/auto_save_session"
--- src/gpm-screensaver.c.orig	2008-03-19 22:34:35.519979000 +0800
+++ src/gpm-screensaver.c	2008-03-27 12:34:08.147100000 +0800
@@ -29,6 +29,10 @@
 #include "gpm-conf.h"
 #include "gpm-screensaver.h"
 #include "egg-debug.h"
+#if defined(sun) && defined(__SVR4)
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#endif
 #include <libdbus-proxy.h>
 
 static void     gpm_screensaver_class_init (GpmScreensaverClass *klass);
@@ -239,6 +243,49 @@
 	guint sleepcount = 0;
 	DBusGProxy *proxy;
 
+#if defined(sun) && defined(__SVR4)
+	GError    *error = NULL;
+	char      *command;
+	GdkScreen *screen;
+	GtkWidget *invisible;
+
+	/* As per ARC requriement, use xdg-screensaver on Solaris */
+	command = g_strdup ("/usr/bin/xdg-screensaver lock");	
+	screen = gdk_screen_get_default ();
+
+	egg_debug ("Doing xdg-screensaver lock");
+	if (! gdk_spawn_command_line_on_screen (screen, command, &error)) {
+		g_warning ("Cannot lock screen: %s", error->message);
+		g_error_free (error);
+	}
+	g_free (command);
+
+	/* Make sure screen locking takes effect until both point 
+	 * and keyboard are grabbed successfully.
+	 */
+	invisible = gtk_invisible_new_for_screen (screen);
+	gtk_widget_show (invisible);
+	while (sleepcount++ < 50) {
+		egg_debug ("Try to determine if screen lock is active!");
+		if (gdk_pointer_grab (invisible->window, 
+				TRUE, 
+				0,
+				NULL,
+				NULL,
+				GDK_CURRENT_TIME) 
+				== GDK_GRAB_ALREADY_GRABBED 
+		   && gdk_keyboard_grab (invisible->window, FALSE, GDK_CURRENT_TIME)
+		  		== GDK_GRAB_ALREADY_GRABBED)
+			break;
+		else {
+			gdk_pointer_ungrab (GDK_CURRENT_TIME);
+			gdk_keyboard_ungrab (GDK_CURRENT_TIME);
+		}
+		g_usleep (1000 * 100);
+	} 
+	gtk_widget_destroy (invisible);
+	egg_debug ("Screen locking is sucessful!, sleepcount = %d", sleepcount);
+#else
 	g_return_val_if_fail (GPM_IS_SCREENSAVER (screensaver), FALSE);
 
 	proxy = dbus_proxy_get_proxy (screensaver->priv->gproxy);
@@ -265,6 +312,7 @@
 			break;
 		}
 	}
+#endif
 
 	return TRUE;
 }
--- src/gpm-prefs-core.c.orig	2008-08-07 13:42:30.764652576 +0800
+++ src/gpm-prefs-core.c	2008-08-07 13:48:01.063915852 +0800
@@ -770,6 +770,10 @@
 	/* set up the sound checkbox */
 	gpm_prefs_setup_checkbox (prefs, "checkbutton_notification_sound",
 	  			  GPM_CONF_UI_ENABLE_BEEPING);
+	
+	/* set up the screen locking checkbox */
+	gpm_prefs_setup_checkbox (prefs, "checkbutton_screen_lock",
+                                 GPM_CONF_UI_ENABLE_SCREEN_LOCK);
 
 	if (prefs->priv->has_batteries) {
 		/* there's no use case for displaying this option */
--- data/gpm-prefs.glade.orig	2008-09-19 10:41:33.055069000 +0800
+++ data/gpm-prefs.glade	2008-09-19 10:41:49.819455000 +0800
@@ -1145,6 +1145,21 @@
                                 <property name="position">3</property>
                               </packing>
                             </child>
+                            <child>
+                              <widget class="GtkCheckButton" id="checkbutton_screen_lock">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="label" translatable="yes" comments="SUN_BRANDING">_Lock screen when computer is restored from blank screen, suspend or hibernate</property>
+                                <property name="use_underline">True</property>
+                                <property name="response_id">0</property>
+                                <property name="draw_indicator">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">4</property>
+                              </packing>
+                            </child>
                           </widget>
                         </child>
                       </widget>
