diff options
author | Danny Baumann <dannybaumann@web.de> | 2008-03-09 13:02:19 +0100 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2008-03-09 13:02:19 +0100 |
commit | 410be7283d25bbacbb14a885dee6585a42493041 (patch) | |
tree | 754d81230381a1f20582e75d5f3ebbeb16b233c3 | |
parent | 59fa7e7791489e256f4f71cfbb611921006dfa6e (diff) |
Add a sessionInit and a sessionFini callback function.
Use sessionInit to transmit information about client ids.
-rw-r--r-- | include/compiz-core.h | 16 | ||||
-rw-r--r-- | src/core.c | 2 | ||||
-rw-r--r-- | src/session.c | 49 |
3 files changed, 49 insertions, 18 deletions
diff --git a/include/compiz-core.h b/include/compiz-core.h index c99078f3..5a4571d2 100644 --- a/include/compiz-core.h +++ b/include/compiz-core.h @@ -353,6 +353,12 @@ typedef enum { CompSessionEventShutdownCancelled } CompSessionEvent; +typedef void (*SessionInitProc) (CompCore *c, + const char *previousClientId, + const char *clientId); + +typedef void (*SessionFiniProc) (CompCore *c); + typedef void (*SessionEventProc) (CompCore *c, CompSessionEvent event, CompOption *arguments, @@ -365,6 +371,14 @@ void closeSession (void); void +sessionInit (CompCore *c, + const char *previousClientId, + const char *clientId); + +void +sessionFini (CompCore *c); + +void sessionEvent (CompCore *c, CompSessionEvent event, CompOption *arguments, @@ -673,6 +687,8 @@ struct _CompCore { FileWatchAddedProc fileWatchAdded; FileWatchRemovedProc fileWatchRemoved; + SessionInitProc sessionInit; + SessionFiniProc sessionFini; SessionEventProc sessionEvent; }; @@ -194,6 +194,8 @@ initCore (void) core.fileWatchAdded = fileWatchAdded; core.fileWatchRemoved = fileWatchRemoved; + core.sessionInit = sessionInit; + core.sessionFini = sessionFini; core.sessionEvent = sessionEvent; corePlugin = loadPlugin ("core"); diff --git a/src/session.c b/src/session.c index dddcc170..44f430ce 100644 --- a/src/session.c +++ b/src/session.c @@ -140,29 +140,25 @@ saveYourselfCallback (SmcConn connection, int interact_Style, Bool fast) { - CompOption args[5]; + CompOption args[4]; - args[0].type = CompOptionTypeString; - args[0].name = "client_id"; - args[0].value.s = smClientId; + args[0].type = CompOptionTypeInt; + args[0].name = "save_type"; + args[0].value.i = saveType; - args[1].type = CompOptionTypeInt; - args[1].name = "save_type"; - args[1].value.i = saveType; + args[1].type = CompOptionTypeBool; + args[1].name = "shutdown"; + args[1].value.b = shutdown; - args[2].type = CompOptionTypeBool; - args[2].name = "shutdown"; - args[2].value.b = shutdown; + args[2].type = CompOptionTypeInt; + args[2].name = "interact_style"; + args[2].value.i = interact_Style; - args[3].type = CompOptionTypeInt; - args[3].name = "interact_style"; - args[3].value.i = interact_Style; + args[3].type = CompOptionTypeBool; + args[3].name = "fast"; + args[3].value.b = fast; - args[4].type = CompOptionTypeBool; - args[4].name = "fast"; - args[4].value.b = fast; - - (*core.sessionEvent) (&core, CompSessionEventSaveYourself, args, 5); + (*core.sessionEvent) (&core, CompSessionEventSaveYourself, args, 4); setCloneRestartCommands (connection); setRestartStyle (connection, SmRestartImmediately); @@ -235,6 +231,9 @@ initSession (char *smPrevClientId) errorBuffer); else connected = TRUE; + + if (connected) + (*core.sessionInit) (&core, smPrevClientId, smClientId); } } @@ -243,6 +242,8 @@ closeSession (void) { if (connected) { + (*core.sessionFini) (&core); + setRestartStyle (smcConnection, SmRestartIfRunning); if (SmcCloseConnection (smcConnection, 0, NULL) != SmcConnectionInUse) @@ -255,6 +256,18 @@ closeSession (void) } void +sessionInit (CompCore *c, + const char *previousClientId, + const char *clientId) +{ +} + +void +sessionFini (CompCore *c) +{ +} + +void sessionEvent (CompCore *c, CompSessionEvent event, CompOption *arguments, |