From 5f9204b734e72cf5a721924f21a75a062e775e1e Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Wed, 30 Jan 2008 10:55:28 +0100 Subject: [PATCH] Added wrappable callback functions for session management events. --- include/compiz-core.h | 51 +++++++++++++++++++++++++++++++++++++++--------- src/core.c | 5 ++++ src/session.c | 31 +++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 10 deletions(-) diff --git a/include/compiz-core.h b/include/compiz-core.h index 8aadf7b..9c8314c 100644 --- a/include/compiz-core.h +++ b/include/compiz-core.h @@ -28,7 +28,7 @@ #include -#define CORE_ABIVERSION 20071103 +#define CORE_ABIVERSION 20080130 #include #include @@ -344,6 +344,41 @@ compObjectFind (CompObject *parent, else \ return (def) +/* session.c */ + +typedef void (*SessionSaveYourselfProc) (CompCore *c, + int saveType, + int interactStyle, + Bool shutdown, + Bool fast); + +typedef void (*SessionDieProc) (CompCore *c); + +typedef void (*SessionSaveCompleteProc) (CompCore *c); + +typedef void (*SessionShutdownCancelledProc) (CompCore *c); + +void +initSession (char *smPrevClientId); + +void +closeSession (void); + +void +sessionSaveYourself (CompCore *c, + int saveType, + int interactStyle, + Bool shutdown, + Bool fast); + +void +sessionDie (CompCore *c); + +void +sessionSaveComplete (CompCore *c); + +void +sessionShutdownCancelled (CompCore *c); /* option.c */ @@ -647,6 +682,11 @@ struct _CompCore { FileWatchAddedProc fileWatchAdded; FileWatchRemovedProc fileWatchRemoved; + + SessionSaveYourselfProc sessionSaveYourself; + SessionDieProc sessionDie; + SessionSaveCompleteProc sessionSaveComplete; + SessionShutdownCancelledProc sessionShutdownCancelled; }; int @@ -3088,15 +3128,6 @@ getPluginDisplayIndex (CompDisplay *d, int *index); -/* session.c */ - -void -initSession (char *smPrevClientId); - -void -closeSession (void); - - /* fragment.c */ #define MAX_FRAGMENT_FUNCTIONS 16 diff --git a/src/core.c b/src/core.c index cd18f77..74bf487 100644 --- a/src/core.c +++ b/src/core.c @@ -194,6 +194,11 @@ initCore (void) core.fileWatchAdded = fileWatchAdded; core.fileWatchRemoved = fileWatchRemoved; + core.sessionSaveYourself = sessionSaveYourself; + core.sessionDie = sessionDie; + core.sessionSaveComplete = sessionSaveComplete; + core.sessionShutdownCancelled = sessionShutdownCancelled; + corePlugin = loadPlugin ("core"); if (!corePlugin) { diff --git a/src/session.c b/src/session.c index 0afa6b7..6193565 100644 --- a/src/session.c +++ b/src/session.c @@ -152,6 +152,9 @@ saveYourselfCallback (SmcConn connection, int interact_Style, Bool fast) { + (*core.sessionSaveYourself) (&core, saveType, interact_Style, + shutdown, fast); + if (!SmcGetProperties (connection, saveYourselfGotProps, NULL)) SmcSaveYourselfDone (connection, 1); } @@ -160,6 +163,8 @@ static void dieCallback (SmcConn connection, SmPointer clientData) { + (*core.sessionDie) (&core); + closeSession (); exit (0); } @@ -168,12 +173,14 @@ static void saveCompleteCallback (SmcConn connection, SmPointer clientData) { + (*core.sessionSaveComplete) (&core); } static void shutdownCancelledCallback (SmcConn connection, SmPointer clientData) { + (*core.sessionShutdownCancelled) (&core); } void @@ -237,6 +244,30 @@ closeSession (void) } } +void +sessionSaveYourself (CompCore *c, + int saveType, + int interactStyle, + Bool shutdown, + Bool fast) +{ +} + +void +sessionDie (CompCore *c) +{ +} + +void +sessionSaveComplete (CompCore *c) +{ +} + +void +sessionShutdownCancelled (CompCore *c) +{ +} + /* ice connection handling taken and updated from gnome-ice.c * original gnome-ice.c code written by Tom Tromey */ -- 1.5.3.8