Anonymous avatar Anonymous committed e457c1d Merge

CWS-TOOLING: integrate CWS gsminhibit

Comments (0)

Files changed (2)

vcl/unx/gtk/window/gtkframe.cxx

 #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"
+#define GSM_DBUS_SERVICE        "org.gnome.SessionManager"
+#define GSM_DBUS_PATH           "/org/gnome/SessionManager"
+#define GSM_DBUS_INTERFACE      "org.gnome.SessionManager"
 #endif
 
 // make compile on gtk older than 2.10
     m_pIMHandler		= NULL;
     m_hBackgroundPixmap = None;
     m_nSavedScreenSaverTimeout = 0;
-    m_nGSSCookie = 0;
+    m_nGSMCookie = 0;
     m_nExtStyle         = 0;
     m_pRegion           = NULL;
     m_ePointerStyle     = 0xffff;
 #ifdef ENABLE_DBUS
 /** cookie is returned as an unsigned integer */
 static guint
-dbus_inhibit_gss (const gchar *appname,
-                  const gchar *reason)
+dbus_inhibit_gsm (const gchar *appname,
+                  const gchar *reason,
+                  guint xid)
 {
         gboolean         res;
         guint            cookie;
                 return -1;
         }
 
-        /* get the proxy with gnome-screensaver */
+        /* get the proxy with gnome-session-manager */
         proxy = dbus_g_proxy_new_for_name (session_connection,
-                                           GSS_DBUS_SERVICE,
-                                           GSS_DBUS_PATH,
-                                           GSS_DBUS_INTERFACE);
+                                           GSM_DBUS_SERVICE,
+                                           GSM_DBUS_PATH,
+                                           GSM_DBUS_INTERFACE);
         if (proxy == NULL) {
-                g_warning ("Could not get DBUS proxy: %s", GSS_DBUS_SERVICE);
+                g_warning ("Could not get DBUS proxy: %s", GSM_DBUS_SERVICE);
                 return -1;
         }
 
         res = dbus_g_proxy_call (proxy,
                                  "Inhibit", &error,
                                  G_TYPE_STRING, appname,
+                                 G_TYPE_UINT, xid,
                                  G_TYPE_STRING, reason,
+                                 G_TYPE_UINT, 8, //Inhibit the session being marked as idle
                                  G_TYPE_INVALID,
                                  G_TYPE_UINT, &cookie,
                                  G_TYPE_INVALID);
 }
 
 static void
-dbus_uninhibit_gss (guint cookie)
+dbus_uninhibit_gsm (guint cookie)
 {
         gboolean         res;
         GError          *error = NULL;
         DBusGProxy      *proxy = NULL;
         DBusGConnection *session_connection = NULL;
 
-        /* cookies have to be positive as unsigned */
-        if (cookie < 0) {
+        if (cookie == guint(-1)) {
                 g_warning ("Invalid cookie");
                 return;
         }
                 return;
         }
 
-        /* get the proxy with gnome-screensaver */
+        /* get the proxy with gnome-session-manager */
         proxy = dbus_g_proxy_new_for_name (session_connection,
-                                           GSS_DBUS_SERVICE,
-                                           GSS_DBUS_PATH,
-                                           GSS_DBUS_INTERFACE);
+                                           GSM_DBUS_SERVICE,
+                                           GSM_DBUS_PATH,
+                                           GSM_DBUS_INTERFACE);
         if (proxy == NULL) {
-                g_warning ("Could not get DBUS proxy: %s", GSS_DBUS_SERVICE);
+                g_warning ("Could not get DBUS proxy: %s", GSM_DBUS_SERVICE);
                 return;
         }
 
         res = dbus_g_proxy_call (proxy,
-                                 "UnInhibit",
+                                 "Uninhibit",
                                  &error,
                                  G_TYPE_UINT, cookie,
                                  G_TYPE_INVALID,
 
         /* check the return value */
         if (! res) {
-                g_warning ("UnInhibit method failed");
+                g_warning ("Uninhibit method failed");
         }
 
         /* check the error value */
         if (error != NULL) {
-                g_warning ("Inhibit problem : %s", error->message);
+                g_warning ("Uninhibit problem : %s", error->message);
                 g_error_free (error);
                 cookie = -1;
         }
 							 bPreferBlanking, bAllowExposures );
 		}
 #ifdef ENABLE_DBUS
-		m_nGSSCookie = dbus_inhibit_gss(g_get_application_name(), "presentation");
+		m_nGSMCookie = dbus_inhibit_gsm(g_get_application_name(), "presentation", 
+                    GDK_WINDOW_XID(m_pWindow->window));
 #endif
 	}
 	else
 							 bAllowExposures );
 		m_nSavedScreenSaverTimeout = 0;
 #ifdef ENABLE_DBUS
-		dbus_uninhibit_gss(m_nGSSCookie);
+		dbus_uninhibit_gsm(m_nGSMCookie);
 #endif
 	}
 }

vcl/unx/inc/plugins/gtk/gtkframe.hxx

     GdkVisibilityState              m_nVisibility;
     PointerStyle                    m_ePointerStyle;
     int                             m_nSavedScreenSaverTimeout;
-    guint                           m_nGSSCookie;
+    guint                           m_nGSMCookie;
     int                             m_nWorkArea;
     bool                            m_bFullscreen;
     bool                            m_bSingleAltPress;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.