This is necessary for the following GDBus integration, which drops session_info_get_fd(). The vdagentd therefore won't be able to detect session changes using select(). --- src/vdagentd/console-kit.c | 2 +- src/vdagentd/dummy-session-info.c | 2 +- src/vdagentd/session-info.h | 4 +++- src/vdagentd/systemd-login.c | 2 +- src/vdagentd/vdagentd.c | 8 +++++++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/vdagentd/console-kit.c b/src/vdagentd/console-kit.c index 381b97e..ef49db5 100644 --- a/src/vdagentd/console-kit.c +++ b/src/vdagentd/console-kit.c @@ -217,7 +217,7 @@ si_dbus_read_signals(struct session_info *info) } } -struct session_info *session_info_create(int verbose) +struct session_info *session_info_create(int verbose, ActiveSessionChangeCb cb) { struct session_info *info; DBusError error; diff --git a/src/vdagentd/dummy-session-info.c b/src/vdagentd/dummy-session-info.c index 1be27ae..b2306d7 100644 --- a/src/vdagentd/dummy-session-info.c +++ b/src/vdagentd/dummy-session-info.c @@ -21,7 +21,7 @@ #include "session-info.h" -struct session_info *session_info_create(int verbose) +struct session_info *session_info_create(int verbose, ActiveSessionChangeCb cb) { return NULL; } diff --git a/src/vdagentd/session-info.h b/src/vdagentd/session-info.h index c8edb86..2f21347 100644 --- a/src/vdagentd/session-info.h +++ b/src/vdagentd/session-info.h @@ -28,7 +28,9 @@ struct session_info; -struct session_info *session_info_create(int verbose); +typedef void (*ActiveSessionChangeCb)(const gchar *session); + +struct session_info *session_info_create(int verbose, ActiveSessionChangeCb cb); void session_info_destroy(struct session_info *ck); int session_info_get_fd(struct session_info *ck); diff --git a/src/vdagentd/systemd-login.c b/src/vdagentd/systemd-login.c index 9719c0b..88de1a6 100644 --- a/src/vdagentd/systemd-login.c +++ b/src/vdagentd/systemd-login.c @@ -225,7 +225,7 @@ si_dbus_read_signals(struct session_info *si) } } -struct session_info *session_info_create(int verbose) +struct session_info *session_info_create(int verbose, ActiveSessionChangeCb cb) { struct session_info *si; int r; diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c index 8893f3b..6d117a8 100644 --- a/src/vdagentd/vdagentd.c +++ b/src/vdagentd/vdagentd.c @@ -990,6 +990,12 @@ static void agent_read_complete(struct udscs_connection **connp, } } +static void active_session_change_cb(const gchar *session) +{ + active_session = session; + update_active_session_connection(NULL); +} + /* main */ static void daemonize(void) @@ -1156,7 +1162,7 @@ int main(int argc, char *argv[]) #endif if (want_session_info) - session_info = session_info_create(debug); + session_info = session_info_create(debug, active_session_change_cb); if (!session_info) syslog(LOG_WARNING, "no session info, max 1 session agent allowed"); -- 2.17.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel