--- vcl/unx/gtk/a11y/makefile.mk.orig	2006-05-26 12:26:01.000000000 +0200
+++ vcl/unx/gtk/a11y/makefile.mk	2006-05-26 12:26:30.000000000 +0200
@@ -59,7 +59,11 @@ dummy:
 
 .IF "$(ENABLE_GTK)" != ""
 
-PKGCONFIG_MODULES=gtk+-2.0
+.IF "$(ENABLE_DBUS)" == "YES"
+CDEFS+= -DENABLE_DBUS
+.ENDIF
+
+PKGCONFIG_MODULES=gtk+-2.0 $(DBUS_PACKAGE)
 .INCLUDE : pkg_config.mk
 
 CFLAGS+=-DVERSION=\"$(UPD)$(LAST_MINOR)\"
diff -rup ../src680-m165-orig/vcl/unx/gtk/app/makefile.mk vcl/unx/gtk/app/makefile.mk
--- ../src680-m165-orig/vcl/unx/gtk/app/makefile.mk	2005-09-09 14:36:54.000000000 +0200
+++ vcl/unx/gtk/app/makefile.mk	2006-05-25 09:22:07.000000000 +0200
@@ -58,7 +58,11 @@ dummy:
 
 .IF "$(ENABLE_GTK)" != ""
 
-PKGCONFIG_MODULES=gtk+-2.0
+.IF "$(ENABLE_DBUS)" == "YES"
+CDEFS+= -DENABLE_DBUS
+.ENDIF
+
+PKGCONFIG_MODULES=gtk+-2.0 $(DBUS_PACKAGE)
 .INCLUDE : pkg_config.mk
 
 SLOFILES=\
diff -rup ../src680-m165-orig/vcl/unx/gtk/gdi/makefile.mk vcl/unx/gtk/gdi/makefile.mk
--- ../src680-m165-orig/vcl/unx/gtk/gdi/makefile.mk	2005-09-09 14:37:10.000000000 +0200
+++ vcl/unx/gtk/gdi/makefile.mk	2006-05-25 09:22:07.000000000 +0200
@@ -55,7 +55,11 @@ dummy:
 
 .IF "$(ENABLE_GTK)" != ""
 
-PKGCONFIG_MODULES=gtk+-2.0
+.IF "$(ENABLE_DBUS)" == "YES"
+CDEFS+= -DENABLE_DBUS
+.ENDIF
+
+PKGCONFIG_MODULES=gtk+-2.0 $(DBUS_PACKAGE)
 .INCLUDE : pkg_config.mk
 
 SLOFILES=\
diff -rup ../src680-m165-orig/vcl/unx/gtk/window/gtkframe.cxx vcl/unx/gtk/window/gtkframe.cxx
--- ../src680-m165-orig/vcl/unx/gtk/window/gtkframe.cxx	2006-05-25 10:55:26.000000000 +0200
+++ vcl/unx/gtk/window/gtkframe.cxx	2006-05-25 10:38:25.000000000 +0200
@@ -66,6 +66,10 @@
 
 using namespace com::sun::star;
 
+#ifdef ENABLE_DBUS
+#include <dbus/dbus-glib-lowlevel.h>
+#endif
+
 int GtkSalFrame::m_nFloats = 0;
 
 static USHORT GetKeyModCode( guint state )
@@ -491,6 +493,10 @@ void GtkSalFrame::InitCommon()
     m_hBackgroundPixmap = None;
     m_nSavedScreenSaverTimeout = 0;
     m_nExtStyle         = 0;
+#ifdef ENABLE_DBUS
+	m_nGnomeScreenSaverPokeTimeoutId = 0;
+	m_pDBusConnection   = NULL;
+#endif
 
     gtk_widget_set_app_paintable( GTK_WIDGET(m_pWindow), TRUE );
     gtk_widget_set_double_buffered( GTK_WIDGET(m_pWindow), FALSE );
@@ -1559,6 +1563,44 @@ void GtkSalFrame::setAutoLock( bool bLoc
 					 sizeof( nMessage ) );
 }
 
+#ifdef ENABLE_DBUS
+#define GS_SERVICE   "org.gnome.ScreenSaver"
+#define GS_PATH      "/org/gnome/ScreenSaver"
+#define GS_INTERFACE "org.gnome.ScreenSaver"
+
+static gboolean
+pokeGnomeScreenSaver( gpointer data )
+{
+	DBusConnection *pConnection = (DBusConnection*) data;
+	DBusMessage *pMessage;
+	DBusError    pError;
+
+	g_return_val_if_fail( pConnection != NULL, FALSE );
+
+	dbus_error_init( &pError );
+
+	pMessage = dbus_message_new_method_call (GS_SERVICE, GS_PATH, GS_INTERFACE, "Poke");
+	if( pMessage == NULL ) {
+		OSL_TRACE( "Couldn't allocate the dbus message" );
+		return FALSE;
+	}
+
+	if( !dbus_connection_send( pConnection, pMessage, NULL ) )
+		OSL_TRACE( "could not send dbus message" );
+
+	dbus_connection_flush( pConnection );
+
+	dbus_message_unref( pMessage );
+
+	if( dbus_error_is_set( &pError ) )
+	  dbus_error_free( &pError );
+
+	OSL_TRACE( "Poke message sent" );
+
+	return TRUE;
+}
+#endif
+
 void GtkSalFrame::StartPresentation( BOOL bStart )
 {
 	Display *pDisplay = GDK_DISPLAY_XDISPLAY( getGdkDisplay() );
@@ -1571,6 +1611,7 @@ void GtkSalFrame::StartPresentation( BOO
 					 &bPreferBlanking, &bAllowExposures );
 	if( bStart )
 	{
+		/* disable X server built-in screensaver */
 		if ( nTimeout )
 		{
 			m_nSavedScreenSaverTimeout = nTimeout;
@@ -1578,14 +1619,55 @@ void GtkSalFrame::StartPresentation( BOO
 			XSetScreenSaver( pDisplay, 0, nInterval,
 							 bPreferBlanking, bAllowExposures );
 		}
+
+#ifdef ENABLE_DBUS
+		/* setup 30 seconds timeout to poke gnome-screensaver thru DBus connection */
+		if( !m_pDBusConnection ) {
+			DBusError pDBusError;
+
+			OSL_TRACE( "trying to create dbus connection" );
+
+			dbus_error_init( &pDBusError );
+			m_pDBusConnection = dbus_bus_get( DBUS_BUS_SESSION, &pDBusError );
+
+			if( dbus_error_is_set( &pDBusError ) )
+			  dbus_error_free( &pDBusError );
+
+			if( m_pDBusConnection ) {
+				dbus_connection_setup_with_g_main( m_pDBusConnection, NULL );
+				OSL_TRACE( "dbus connection created" );
+
+				/* poke the screensaver now so that it doesn't kick in in the first 30 seconds of slideshow */
+				pokeGnomeScreenSaver( m_pDBusConnection );
+			}
+		}
+
+		if( m_pDBusConnection )
+			m_nGnomeScreenSaverPokeTimeoutId = g_timeout_add( 30000, pokeGnomeScreenSaver, m_pDBusConnection );
+#endif
 	}
 	else
 	{
+		/* restore X server built-in screensaver settings */
 		if( m_nSavedScreenSaverTimeout )
 			XSetScreenSaver( pDisplay, m_nSavedScreenSaverTimeout,
 							 nInterval, bPreferBlanking,
 							 bAllowExposures );
 		m_nSavedScreenSaverTimeout = 0;
+
+#ifdef ENABLE_DBUS
+		/* remove timeout for poking gnome-screensaver */
+		if( m_nGnomeScreenSaverPokeTimeoutId ) {
+			g_source_remove( m_nGnomeScreenSaverPokeTimeoutId );
+			m_nGnomeScreenSaverPokeTimeoutId = 0;
+			OSL_TRACE( "screensaver poking timeout removed" );
+
+			dbus_connection_close( m_pDBusConnection );
+			dbus_connection_unref( m_pDBusConnection );
+			m_pDBusConnection = NULL;
+			OSL_TRACE( "dbus connection disconnected and unrefed" );
+		}
+#endif
 	}
 }
 
diff -rup ../src680-m165-orig/vcl/unx/gtk/window/makefile.mk vcl/unx/gtk/window/makefile.mk
--- ../src680-m165-orig/vcl/unx/gtk/window/makefile.mk	2005-09-09 14:38:24.000000000 +0200
+++ vcl/unx/gtk/window/makefile.mk	2006-05-25 09:22:07.000000000 +0200
@@ -58,7 +58,11 @@ dummy:
 
 .IF "$(ENABLE_GTK)" != ""
 
-PKGCONFIG_MODULES=gtk+-2.0
+.IF "$(ENABLE_DBUS)" == "YES"
+CDEFS+= -DENABLE_DBUS
+.ENDIF
+
+PKGCONFIG_MODULES=gtk+-2.0 $(DBUS_PACKAGE)
 .INCLUDE : pkg_config.mk
 
 SLOFILES=\
diff -rup ../src680-m165-orig/vcl/unx/inc/plugins/gtk/gtkframe.hxx vcl/unx/inc/plugins/gtk/gtkframe.hxx
--- ../src680-m165-orig/vcl/unx/inc/plugins/gtk/gtkframe.hxx	2006-05-25 10:55:26.000000000 +0200
+++ vcl/unx/inc/plugins/gtk/gtkframe.hxx	2006-05-25 09:22:07.000000000 +0200
@@ -46,6 +46,12 @@
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/accessibility/XAccessible.hdl>
 
+#ifdef ENABLE_DBUS
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#endif
+
 #ifndef _SV_SALFRAME_HXX
 #include <salframe.hxx>
 #endif
@@ -201,6 +205,11 @@ class GtkSalFrame : public SalFrame
     Size                            m_aMaxSize;
     Size                            m_aMinSize;
     Rectangle                       m_aRestorePosSize;    
+
+#ifdef ENABLE_DBUS
+	DBusConnection                 *m_pDBusConnection;
+	guint                           m_nGnomeScreenSaverPokeTimeoutId;
+#endif
     
     void Init( SalFrame* pParent, ULONG nStyle );
     void Init( SystemParentData* pSysData );
diff -rup ../src680-m165-orig/vcl/util/makefile.mk vcl/util/makefile.mk
--- ../src680-m165-orig/vcl/util/makefile.mk	2006-05-25 10:55:26.000000000 +0200
+++ vcl/util/makefile.mk	2006-05-25 09:22:07.000000000 +0200
@@ -352,7 +352,11 @@ SHL3STDLIBS=\
 
 # gtk plugin
 .IF "$(ENABLE_GTK)" != ""
-PKGCONFIG_MODULES=gtk+-2.0 gthread-2.0
+.IF "$(ENABLE_DBUS)" == "YES"
+CDEFS+= -DENABLE_DBUS
+.ENDIF
+
+PKGCONFIG_MODULES=gtk+-2.0 gthread-2.0 $(DBUS_PACKAGE)
 .INCLUDE: pkg_config.mk
 
 LIB4TARGET=$(SLB)$/igtk_plug_

