summaryrefslogtreecommitdiff
path: root/src/session.cpp
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@compiz-fusion.org>2008-08-20 19:52:06 +0200
committerDennis kasprzyk <onestone@compiz-fusion.org>2008-08-20 19:52:06 +0200
commit7dee054a80fec3640fa5b4621325ce768008a152 (patch)
treeb5ffab42859355bf2e964236693531eddd868dee /src/session.cpp
parent01b0aa33dfe61e00adfa390e2fc36087e3c9ab2e (diff)
downloadunity-window-decorator-7dee054a80fec3640fa5b4621325ce768008a152.tar.gz
unity-window-decorator-7dee054a80fec3640fa5b4621325ce768008a152.tar.bz2
Moved session related functions/structs into own header and namespace.
Diffstat (limited to 'src/session.cpp')
-rw-r--r--src/session.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/session.cpp b/src/session.cpp
index 99c1d23..6efb27a 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -36,14 +36,15 @@
#include <X11/SM/SMlib.h>
#include <X11/ICE/ICElib.h>
+#include <compsession.h>
#include <compiz-core.h>
#define SM_DEBUG(x)
static SmcConn smcConnection;
static CompWatchFdHandle iceWatchFdHandle;
-static Bool connected = 0;
-static Bool iceConnected = 0;
+static bool connected = false;
+static bool iceConnected = false;
static char *smClientId, *smPrevClientId;
static void iceInit (void);
@@ -58,7 +59,7 @@ setStringListProperty (SmcConn connection,
int i;
prop.name = (char *) name;
- prop.type = SmLISTofARRAY8;
+ prop.type = const_cast<char *> (SmLISTofARRAY8);
prop.vals = (SmPropValue *) malloc (nValues * sizeof (SmPropValue));
if (!prop.vals)
@@ -123,8 +124,8 @@ setRestartStyle (SmcConn connection,
SmProp prop, *pProp;
SmPropValue propVal;
- prop.name = SmRestartStyleHint;
- prop.type = SmCARD8;
+ prop.name = const_cast<char *> (SmRestartStyleHint);
+ prop.type = const_cast<char *> (SmCARD8);
prop.num_vals = 1;
prop.vals = &propVal;
propVal.value = &hint;
@@ -142,8 +143,8 @@ setProgram (SmcConn connection,
SmProp prop, *pProp;
SmPropValue propVal;
- prop.name = SmProgram;
- prop.type = SmARRAY8;
+ prop.name = const_cast<char *> (SmProgram);
+ prop.type = const_cast<char *> (SmARRAY8);
prop.num_vals = 1;
prop.vals = &propVal;
propVal.value = (SmPointer) program;
@@ -174,7 +175,7 @@ saveYourselfCallback (SmcConn connection,
args[2].value ().set (interact_Style);
args[3].value ().set ((bool) fast);
- core->sessionEvent (CompSessionEventSaveYourself, args);
+ core->sessionEvent (CompSession::EventSaveYourself, args);
setCloneRestartCommands (connection);
setRestartStyle (connection, SmRestartImmediately);
@@ -186,9 +187,9 @@ static void
dieCallback (SmcConn connection,
SmPointer clientData)
{
- core->sessionEvent (CompSessionEventDie, noOptions);
+ core->sessionEvent (CompSession::EventDie, noOptions);
- closeSession ();
+ CompSession::closeSession ();
exit (0);
}
@@ -196,18 +197,18 @@ static void
saveCompleteCallback (SmcConn connection,
SmPointer clientData)
{
- core->sessionEvent (CompSessionEventSaveComplete, noOptions);
+ core->sessionEvent (CompSession::EventSaveComplete, noOptions);
}
static void
shutdownCancelledCallback (SmcConn connection,
SmPointer clientData)
{
- core->sessionEvent (CompSessionEventShutdownCancelled, noOptions);
+ core->sessionEvent (CompSession::EventShutdownCancelled, noOptions);
}
void
-initSession (char *prevClientId)
+CompSession::initSession (char *prevClientId)
{
static SmcCallbacks callbacks;
@@ -256,7 +257,7 @@ initSession (char *prevClientId)
}
void
-closeSession (void)
+CompSession::closeSession (void)
{
if (connected)
{
@@ -278,21 +279,20 @@ closeSession (void)
}
char *
-getSessionClientId (CompSessionClientIdType type)
+CompSession::getSessionClientId (CompSession::ClientIdType type)
{
if (!connected)
return NULL;
switch (type) {
- case CompSessionClientId:
- if (smClientId)
- return strdup (smClientId);
- break;
-
- case CompSessionPrevClientId:
- if (smPrevClientId)
- return strdup (smPrevClientId);
- break;
+ case CompSession::ClientId:
+ if (smClientId)
+ return strdup (smClientId);
+ break;
+ case CompSession::PrevClientId:
+ if (smPrevClientId)
+ return strdup (smPrevClientId);
+ break;
}
return NULL;