summaryrefslogtreecommitdiff
path: root/src/session.cpp
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2009-03-05 20:42:59 +0100
committerDanny Baumann <dannybaumann@web.de>2009-03-05 20:42:59 +0100
commit00a027e1e7198880e98e5c1e4134aa7a0f911d7b (patch)
tree4f7ce3d02ac85764e5e0e12432f30e1feb9894e5 /src/session.cpp
parentc870ab2b7f0be92dfd7eacc422d3d7a5333927c1 (diff)
downloadunity-window-decorator-00a027e1e7198880e98e5c1e4134aa7a0f911d7b.tar.gz
unity-window-decorator-00a027e1e7198880e98e5c1e4134aa7a0f911d7b.tar.bz2
Improve session API.
Diffstat (limited to 'src/session.cpp')
-rw-r--r--src/session.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/session.cpp b/src/session.cpp
index 9cdc81b..0547ec8 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -49,7 +49,7 @@ static SmcConn smcConnection;
static CompWatchFdHandle iceWatchFdHandle;
static bool connected = false;
static bool iceConnected = false;
-static char *smClientId, *smPrevClientId;
+static char *smClientId, *smPrevClientId;
static void iceInit (void);
@@ -193,7 +193,7 @@ dieCallback (SmcConn connection,
{
screen->sessionEvent (CompSession::EventDie, noOptions);
- CompSession::closeSession ();
+ CompSession::close ();
exit (0);
}
@@ -212,7 +212,7 @@ shutdownCancelledCallback (SmcConn connection,
}
void
-CompSession::initSession (char *prevClientId)
+CompSession::init (char *prevClientId)
{
static SmcCallbacks callbacks;
@@ -261,7 +261,7 @@ CompSession::initSession (char *prevClientId)
}
void
-CompSession::closeSession (void)
+CompSession::close ()
{
if (connected)
{
@@ -269,6 +269,7 @@ CompSession::closeSession (void)
if (SmcCloseConnection (smcConnection, 0, NULL) != SmcConnectionInUse)
connected = FALSE;
+
if (smClientId)
{
free (smClientId);
@@ -282,24 +283,22 @@ CompSession::closeSession (void)
}
}
-char *
-CompSession::getSessionClientId (CompSession::ClientIdType type)
+CompString
+CompSession::getClientId (CompSession::ClientIdType type)
{
if (!connected)
- return NULL;
+ return "";
switch (type) {
case CompSession::ClientId:
if (smClientId)
- return strdup (smClientId);
- break;
+ return smClientId;
case CompSession::PrevClientId:
if (smPrevClientId)
- return strdup (smPrevClientId);
- break;
+ return smPrevClientId;
}
- return NULL;
+ return "";
}
/* ice connection handling taken and updated from gnome-ice.c
* original gnome-ice.c code written by Tom Tromey <tromey@cygnus.com>