rpms/openoffice.org/devel openoffice.org.ooo79953.dbusinhibitscreensaver.patch, NONE, 1.1 openoffice.org.spec, 1.1227, 1.1228

Caolan McNamara (caolanm) fedora-extras-commits at redhat.com
Tue Jul 24 09:28:32 UTC 2007


Author: caolanm

Update of /cvs/pkgs/rpms/openoffice.org/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6117

Modified Files:
	openoffice.org.spec 
Added Files:
	openoffice.org.ooo79953.dbusinhibitscreensaver.patch 
Log Message:
for hughsie inhibit screensaver

openoffice.org.ooo79953.dbusinhibitscreensaver.patch:

--- NEW FILE openoffice.org.ooo79953.dbusinhibitscreensaver.patch ---
Index: configure.in
===================================================================
RCS file: /cvs/tools/config_office/configure.in,v
retrieving revision 1.213
diff -u -r1.213 configure.in
--- openoffice.org.orig/config_office/configure.in	3 Jul 2007 12:15:43 -0000	1.213
+++ openoffice.org/config_office/configure.in	24 Jul 2007 09:20:00 -0000
@@ -208,6 +208,10 @@
 [  --enable-cairo          Determines whether to use Cairo canvas backend on
                           platforms where Cairo is available.
 ],,enable_cairo=no)
+AC_ARG_ENABLE(dbus,
+[  --enable-dbus           Determines whether to enable presentation mode 
+                          screensaver control under GNOME via DBUS 
+],,enable_dbus=no)
 AC_ARG_ENABLE(gnome-vfs,
 [  --disable-gnome-vfs     Determines whether to use the Gnome Virtual Filing
                           System on platforms where that VFS is available
@@ -4679,6 +4683,7 @@
 GTK_CFLAGS=""
 GTK_LIBS=""
 ENABLE_SYSTRAY_GTK=""
+ENABLE_DBUS=""
 if test  "$test_gtk" = "yes"; then
 
    if test "$ENABLE_GTK" = "TRUE" ; then
@@ -4689,6 +4694,15 @@
          ENABLE_SYSTRAY_GTK="TRUE"
          BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"
       fi
+
+      AC_MSG_CHECKING([whether to enable DBUS support])
+      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
+          ENABLE_DBUS="TRUE"
+          AC_MSG_RESULT([yes])
+          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
+      else
+          AC_MSG_RESULT([no])
+      fi
    fi
 
    if test "$ENABLE_HEADLESS" = "TRUE" ; then
@@ -4696,6 +4710,7 @@
    fi
 
 fi
+AC_SUBST(ENABLE_DBUS)
 AC_SUBST(ENABLE_SYSTRAY_GTK)
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
Index: set_soenv.in
===================================================================
RCS file: /cvs/tools/config_office/set_soenv.in,v
retrieving revision 1.152
diff -u -r1.152 set_soenv.in
--- openoffice.org.orig/config_office/set_soenv.in	27 Jun 2007 17:52:06 -0000	1.152
+++ openoffice.org/config_office/set_soenv.in	24 Jul 2007 09:20:02 -0000
@@ -1546,6 +1546,7 @@
 ToFile( "ENABLE_SYSTRAY_GTK", "@ENABLE_SYSTRAY_GTK@", "e" );
 ToFile( "ENABLE_STATIC_GTK", "@ENABLE_STATIC_GTK@", "e" );
 ToFile( "ENABLE_CAIRO",      "@ENABLE_CAIRO@",     "e" );
+ToFile( "ENABLE_DBUS",       "@ENABLE_DBUS@",      "e" );
 ToFile( "ENABLE_GNOMEVFS",   "@ENABLE_GNOMEVFS@",  "e" );
 ToFile( "ENABLE_KDE",        "@ENABLE_KDE@",       "e" );
 ToFile( "KDE_CFLAGS",        "@KDE_CFLAGS@",       "e" );
? unxlngx6.pro
Index: unx/gtk/window/gtkframe.cxx
===================================================================
RCS file: /cvs/gsl/vcl/unx/gtk/window/gtkframe.cxx,v
retrieving revision 1.64
diff -u -r1.64 gtkframe.cxx
--- openoffice.org.orig/vcl/unx/gtk/window/gtkframe.cxx	27 Jun 2007 20:38:26 -0000	1.64
+++ openoffice.org/vcl/unx/gtk/window/gtkframe.cxx	24 Jul 2007 09:16:25 -0000
@@ -69,6 +69,14 @@
 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 
+#ifdef ENABLE_DBUS
+#include <dbus/dbus-glib.h>
+
+#define GSS_DBUS_SERVICE        "org.gnome.ScreenSaver"
+#define GSS_DBUS_PATH           "/org/gnome/ScreenSaver"
+#define GSS_DBUS_INTERFACE      "org.gnome.ScreenSaver"
+#endif
+
 using namespace com::sun::star;
 
 int GtkSalFrame::m_nFloats = 0;
@@ -509,6 +517,7 @@
     m_pIMHandler		= NULL;
     m_hBackgroundPixmap = None;
     m_nSavedScreenSaverTimeout = 0;
+    m_nGSSCookie = 0;
     m_nExtStyle         = 0;
     m_pRegion           = NULL;
     m_ePointerStyle     = 0xffff;
@@ -1680,6 +1689,115 @@
 					 sizeof( nMessage ) );
 }
 
+#ifdef ENABLE_DBUS
+/** cookie is returned as an unsigned integer */
+static guint
+dbus_inhibit_gss (const gchar *appname,
+                  const gchar *reason)
+{
+        gboolean         res;
+        guint            cookie;
+        GError          *error = NULL;
+        DBusGProxy      *proxy = NULL;
+        DBusGConnection *session_connection = NULL;
+
+        /* get the DBUS session connection */
+        session_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+        if (error != NULL) {
+                g_warning ("DBUS cannot connect : %s", error->message);
+                g_error_free (error);
+                return -1;
+        }
+
+        /* get the proxy with gnome-screensaver */
+        proxy = dbus_g_proxy_new_for_name (session_connection,
+                                           GSS_DBUS_SERVICE,
+                                           GSS_DBUS_PATH,
+                                           GSS_DBUS_INTERFACE);
+        if (proxy == NULL) {
+                g_warning ("Could not get DBUS proxy: %s", GSS_DBUS_SERVICE);
+                return -1;
+        }
+
+        res = dbus_g_proxy_call (proxy,
+                                 "Inhibit", &error,
+                                 G_TYPE_STRING, appname,
+                                 G_TYPE_STRING, reason,
+                                 G_TYPE_INVALID,
+                                 G_TYPE_UINT, &cookie,
+                                 G_TYPE_INVALID);
+
+        /* check the return value */
+        if (! res) {
+                cookie = -1;
+                g_warning ("Inhibit method failed");
+        }
+
+        /* check the error value */
+        if (error != NULL) {
+                g_warning ("Inhibit problem : %s", error->message);
+                g_error_free (error);
+                cookie = -1;
+        }
+
+        g_object_unref (G_OBJECT (proxy));
+        return cookie;
+}
+
+static void
+dbus_uninhibit_gss (guint cookie)
+{
+        gboolean         res;
+        GError          *error = NULL;
+        DBusGProxy      *proxy = NULL;
+        DBusGConnection *session_connection = NULL;
+
+        /* cookies have to be positive as unsigned */
+        if (cookie < 0) {
+                g_warning ("Invalid cookie");
+                return;
+        }
+
+        /* get the DBUS session connection */
+        session_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+        if (error) {
+                g_warning ("DBUS cannot connect : %s", error->message);
+                g_error_free (error);
+                return;
+        }
+
+        /* get the proxy with gnome-screensaver */
+        proxy = dbus_g_proxy_new_for_name (session_connection,
+                                           GSS_DBUS_SERVICE,
+                                           GSS_DBUS_PATH,
+                                           GSS_DBUS_INTERFACE);
+        if (proxy == NULL) {
+                g_warning ("Could not get DBUS proxy: %s", GSS_DBUS_SERVICE);
+                return;
+        }
+
+        res = dbus_g_proxy_call (proxy,
+                                 "UnInhibit",
+                                 &error,
+                                 G_TYPE_UINT, cookie,
+                                 G_TYPE_INVALID,
+                                 G_TYPE_INVALID);
+
+        /* check the return value */
+        if (! res) {
+                g_warning ("UnInhibit method failed");
+        }
+
+        /* check the error value */
+        if (error != NULL) {
+                g_warning ("Inhibit problem : %s", error->message);
+                g_error_free (error);
+                cookie = -1;
+        }
+        g_object_unref (G_OBJECT (proxy));
+}
+#endif
+
 void GtkSalFrame::StartPresentation( BOOL bStart )
 {
 	Display *pDisplay = GDK_DISPLAY_XDISPLAY( getGdkDisplay() );
@@ -1699,6 +1817,9 @@
 			XSetScreenSaver( pDisplay, 0, nInterval,
 							 bPreferBlanking, bAllowExposures );
 		}
+#ifdef ENABLE_DBUS
+		m_nGSSCookie = dbus_inhibit_gss(g_get_application_name(), "presentation");
+#endif
 	}
 	else
 	{
@@ -1707,6 +1828,9 @@
 							 nInterval, bPreferBlanking,
 							 bAllowExposures );
 		m_nSavedScreenSaverTimeout = 0;
+#ifdef ENABLE_DBUS
+		dbus_uninhibit_gss(m_nGSSCookie);
+#endif
 	}
 }
 
Index: unx/gtk/window/makefile.mk
===================================================================
RCS file: /cvs/gsl/vcl/unx/gtk/window/makefile.mk,v
retrieving revision 1.9
diff -u -r1.9 makefile.mk
--- openoffice.org.orig/vcl/unx/gtk/window/makefile.mk	19 Jun 2006 19:45:54 -0000	1.9
+++ openoffice.org/vcl/unx/gtk/window/makefile.mk	24 Jul 2007 09:16:25 -0000
@@ -59,6 +59,10 @@
 .IF "$(ENABLE_GTK)" != ""
 
 PKGCONFIG_MODULES=gtk+-2.0
+.IF "$(ENABLE_DBUS)" != ""
+CDEFS+=-DENABLE_DBUS
+PKGCONFIG_MODULES+= dbus-glib-1
+.ENDIF
 .INCLUDE : pkg_config.mk
 
 SLOFILES=\
Index: unx/inc/plugins/gtk/gtkframe.hxx
===================================================================
RCS file: /cvs/gsl/vcl/unx/inc/plugins/gtk/gtkframe.hxx,v
retrieving revision 1.27
diff -u -r1.27 gtkframe.hxx
--- openoffice.org.orig/vcl/unx/inc/plugins/gtk/gtkframe.hxx	27 Jun 2007 20:44:49 -0000	1.27
+++ openoffice.org/vcl/unx/inc/plugins/gtk/gtkframe.hxx	24 Jul 2007 09:16:38 -0000
@@ -192,6 +192,7 @@
     GdkVisibilityState              m_nVisibility;
     PointerStyle                    m_ePointerStyle;
     int                             m_nSavedScreenSaverTimeout;
+    guint                           m_nGSSCookie;
     int                             m_nWorkArea;
     bool                            m_bFullscreen;
     bool                            m_bSingleAltPress;
Index: util/makefile.mk
===================================================================
RCS file: /cvs/gsl/vcl/util/makefile.mk,v
retrieving revision 1.94
diff -u -r1.94 makefile.mk
--- openoffice.org.orig/vcl/util/makefile.mk	5 Jul 2007 08:44:46 -0000	1.94
+++ openoffice.org/vcl/util/makefile.mk	24 Jul 2007 09:17:16 -0000
@@ -351,6 +351,9 @@
 # gtk plugin
 .IF "$(ENABLE_GTK)" != ""
 PKGCONFIG_MODULES=gtk+-2.0 gthread-2.0
+.IF "$(ENABLE_DBUS)" != ""
+PKGCONFIG_MODULES+= dbus-glib-1
+.ENDIF
 .INCLUDE: pkg_config.mk
 
 LIB4TARGET=$(SLB)$/igtk_plug_


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/devel/openoffice.org.spec,v
retrieving revision 1.1227
retrieving revision 1.1228
diff -u -r1.1227 -r1.1228
--- openoffice.org.spec	19 Jul 2007 15:27:26 -0000	1.1227
+++ openoffice.org.spec	24 Jul 2007 09:27:59 -0000	1.1228
@@ -1,6 +1,6 @@
 %define oootag OOF680
 %define ooomilestone 18
-%define rh_rpm_release 6
+%define rh_rpm_release 7
 
 # undef to get english only and no-langpacks for a faster smoketest build
 %define langpacks 1
@@ -149,6 +149,7 @@
 Patch84: openoffice.org-2.2.1.ooo78921.sw.embedded.patch
 Patch85: openoffice.org-2.2.1.oooXXXXX.sw.titlepagedialog.patch
 Patch86: openoffice.org-2.2.1.ooo79481.sw.rowordcount.patch
+Patch87: openoffice.org.ooo79953.dbusinhibitscreensaver.patch
 
 %define instdir %{_libdir}/openoffice.org
 
@@ -1090,6 +1091,7 @@
 %patch84 -p1 -b .ooo78921.sw.embedded.patch
 %patch85 -p1 -b .oooXXXXX.sw.titlepagedialog.patch
 %patch86 -p1 -b .ooo79481.sw.rowordcount.patch
+%patch87 -p1 -b .ooo79953.dbusinhibitscreensaver.patch
 
 cp %{SOURCE1} extras/source/database/evolocal.odb
 
@@ -2688,6 +2690,9 @@
 %{instdir}/share/registry/modules/org/openoffice/Office/Scripting/Scripting-python.xcu
 
 %changelog
+* Tue Jul 24 2007 Caolan McNamara <caolanm at redhat.com> - 1:2.2.1-18.7
+- Resolves: ooo#79953 inhibit screensaver during presentations
+
 * Thu Jul 19 2007 Caolan McNamara <caolanm at redhat.com> - 1:2.2.1-18.6
 - FC-8 Test 1 Candidate
 - Resolves: rhbz#247781 openoffice.org-2.2.1.ooo79481.sw.rowordcount.patch




More information about the scm-commits mailing list