Sort out the dbus function prototypes

* Moved dbus prototypes from common.h to dbus.h
* Removed private function prototypes from dbus.h
* Removed private macros from dbus.h
* Hide dbus types from common.h

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2018-12-20 22:31:34 +00:00
parent eeb1f8f286
commit 4ff9e810ff
5 changed files with 226 additions and 264 deletions

View File

@ -36,6 +36,9 @@
#include "kernel.h"
#include "vsync.h"
#include "log.h"
#ifdef CONFIG_DBUS
#include "dbus.h"
#endif
#define auto __auto_type
@ -3545,8 +3548,7 @@ session_init(session_t *ps_old, int argc, char **argv) {
.track_atom_lst = NULL,
#ifdef CONFIG_DBUS
.dbus_conn = NULL,
.dbus_service = NULL,
.dbus_data = NULL,
#endif
};
@ -3831,6 +3833,19 @@ session_init(session_t *ps_old, int argc, char **argv) {
xcb_grab_server(ps->c);
// Initialize DBus. We need to do this early, because add_win might call dbus functions
if (ps->o.dbus) {
#ifdef CONFIG_DBUS
cdbus_init(ps);
if (!ps->dbus_data) {
ps->o.dbus = false;
}
#else
log_fatal("DBus support not compiled in!");
exit(1);
#endif
}
{
xcb_window_t *children;
int nchildren;
@ -3861,20 +3876,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
// ALWAYS flush after xcb_ungrab_server()!
XFlush(ps->dpy);
// Initialize DBus
if (ps->o.dbus) {
#ifdef CONFIG_DBUS
cdbus_init(ps);
if (!ps->dbus_conn) {
cdbus_destroy(ps);
ps->o.dbus = false;
}
#else
log_fatal("DBus support not compiled in!");
exit(1);
#endif
}
// Fork to background, if asked
if (ps->o.fork_after_register) {
if (!fork_after(ps)) {
@ -3914,10 +3915,10 @@ session_destroy(session_t *ps) {
#ifdef CONFIG_DBUS
// Kill DBus connection
if (ps->o.dbus)
if (ps->o.dbus) {
assert(ps->dbus_data);
cdbus_destroy(ps);
free(ps->dbus_service);
}
#endif
// Free window linked list