summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2009-10-30 14:58:38 +0100
committerVladimir Glazunov <vg@openoffice.org>2009-10-30 14:58:38 +0100
commitb9eb9c5b71a56d631bdea3209abb3405a5169b9d (patch)
treeee5ff75afc203bc80b6bbf79973e9d73d29cd0f8
parentc0f197f920974f3fdaf8278dad16dc5ecb994d52 (diff)
parent5f92cc494e324f3b09c4b640ad73531860405f78 (diff)
CWS-TOOLING: integrate CWS gsminhibit
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx51
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkframe.hxx2
2 files changed, 28 insertions, 25 deletions
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 8963ac2e3643..eff7319d6efc 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -70,9 +70,9 @@
#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
@@ -565,7 +565,7 @@ void GtkSalFrame::InitCommon()
m_pIMHandler = NULL;
m_hBackgroundPixmap = None;
m_nSavedScreenSaverTimeout = 0;
- m_nGSSCookie = 0;
+ m_nGSMCookie = 0;
m_nExtStyle = 0;
m_pRegion = NULL;
m_ePointerStyle = 0xffff;
@@ -1904,8 +1904,9 @@ void GtkSalFrame::setAutoLock( bool bLock )
#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;
@@ -1921,20 +1922,22 @@ dbus_inhibit_gss (const gchar *appname,
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);
@@ -1957,15 +1960,14 @@ dbus_inhibit_gss (const gchar *appname,
}
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;
}
@@ -1978,18 +1980,18 @@ dbus_uninhibit_gss (guint cookie)
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,
@@ -1997,12 +1999,12 @@ dbus_uninhibit_gss (guint cookie)
/* 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;
}
@@ -2030,7 +2032,8 @@ void GtkSalFrame::StartPresentation( BOOL bStart )
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
@@ -2041,7 +2044,7 @@ void GtkSalFrame::StartPresentation( BOOL bStart )
bAllowExposures );
m_nSavedScreenSaverTimeout = 0;
#ifdef ENABLE_DBUS
- dbus_uninhibit_gss(m_nGSSCookie);
+ dbus_uninhibit_gsm(m_nGSMCookie);
#endif
}
}
diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
index 74394c71e4b2..a8fc6f65d4ee 100644
--- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
@@ -180,7 +180,7 @@ class GtkSalFrame : public SalFrame
GdkVisibilityState m_nVisibility;
PointerStyle m_ePointerStyle;
int m_nSavedScreenSaverTimeout;
- guint m_nGSSCookie;
+ guint m_nGSMCookie;
int m_nWorkArea;
bool m_bFullscreen;
bool m_bSingleAltPress;