diff --git a/src/common.h b/src/common.h
index 683fbbb1..8b5cd286 100644
--- a/src/common.h
+++ b/src/common.h
@@ -501,17 +501,6 @@ static inline bool wid_has_prop(xcb_connection_t *c, xcb_window_t w, xcb_atom_t
void force_repaint(session_t *ps);
-/** @name DBus handling
- */
-///@{
-#ifdef CONFIG_DBUS
-/** @name DBus hooks
- */
-///@{
-void opts_set_no_fading_openclose(session_t *ps, bool newval);
-//!@}
-#endif
-
/**
* Set a bool
array of all wintypes to true.
*/
diff --git a/src/dbus.c b/src/dbus.c
index f9553723..58cd036a 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -1322,7 +1322,7 @@ static bool cdbus_process_opts_set(session_t *ps, DBusMessage *msg) {
if (!cdbus_msg_get_arg(msg, 1, DBUS_TYPE_BOOLEAN, &val)) {
return false;
}
- opts_set_no_fading_openclose(ps, val);
+ ps->o.no_fading_openclose = val;
goto cdbus_process_opts_set_success;
}
diff --git a/src/dbus.h b/src/dbus.h
index 54a58af5..ad0b9521 100644
--- a/src/dbus.h
+++ b/src/dbus.h
@@ -11,11 +11,11 @@
#include
-#include
-
typedef struct session session_t;
struct win;
+#ifdef CONFIG_DBUS
+#include
/**
* Return a string representation of a D-Bus message type.
*/
@@ -51,4 +51,29 @@ void cdbus_ev_win_focusout(session_t *ps, struct win *w);
/// Generate dbus win_focusin signal
void cdbus_ev_win_focusin(session_t *ps, struct win *w);
+#else
+
+static inline void
+cdbus_ev_win_unmapped(session_t *ps attr_unused, struct win *w attr_unused) {
+}
+
+static inline void cdbus_ev_win_mapped(session_t *ps attr_unused, struct win *w attr_unused) {
+}
+
+static inline void
+cdbus_ev_win_destroyed(session_t *ps attr_unused, struct win *w attr_unused) {
+}
+
+static inline void cdbus_ev_win_added(session_t *ps attr_unused, struct win *w attr_unused) {
+}
+
+static inline void
+cdbus_ev_win_focusout(session_t *ps attr_unused, struct win *w attr_unused) {
+}
+
+static inline void cdbus_ev_win_focusin(session_t *ps attr_unused, struct win *w attr_unused) {
+}
+
+#endif
+
// vim: set noet sw=8 ts=8 :
diff --git a/src/picom.c b/src/picom.c
index ec26cfe9..8c8ad205 100644
--- a/src/picom.c
+++ b/src/picom.c
@@ -53,27 +53,25 @@
#ifdef CONFIG_OPENGL
#include "opengl.h"
#endif
+#include "atom.h"
#include "backend/backend.h"
#include "c2.h"
-#include "diagnostic.h"
-#include "log.h"
-#include "region.h"
-#include "render.h"
-#include "types.h"
-#include "utils.h"
-#include "win.h"
-#include "x.h"
-#ifdef CONFIG_DBUS
#include "dbus.h"
-#endif
-#include "atom.h"
+#include "diagnostic.h"
#include "event.h"
#include "file_watch.h"
#include "list.h"
+#include "log.h"
#include "options.h"
+#include "region.h"
+#include "render.h"
#include "statistics.h"
+#include "types.h"
#include "uthash_extra.h"
+#include "utils.h"
#include "vblank.h"
+#include "win.h"
+#include "x.h"
/// Get session_t pointer from a pointer to a member of session_t
#define session_ptr(ptr, member) \
@@ -1232,23 +1230,6 @@ void force_repaint(session_t *ps) {
add_damage(ps, &ps->screen_reg);
}
-#ifdef CONFIG_DBUS
-/** @name DBus hooks
- */
-///@{
-
-/**
- * Set no_fading_openclose option.
- *
- * Don't affect fading already in progress
- */
-void opts_set_no_fading_openclose(session_t *ps, bool newval) {
- ps->o.no_fading_openclose = newval;
-}
-
-//!@}
-#endif
-
/**
* Setup window properties, then register us with the compositor selection (_NET_WM_CM_S)
*
@@ -1692,12 +1673,10 @@ static void handle_new_windows(session_t *ps) {
// us to find out. So just blindly mark it damaged
mw->ever_damaged = true;
}
-#ifdef CONFIG_DBUS
// Send D-Bus signal
if (ps->o.dbus) {
cdbus_ev_win_added(ps, new_w);
}
-#endif
}
}
}
diff --git a/src/win.c b/src/win.c
index 09e6a764..8cb4ab05 100644
--- a/src/win.c
+++ b/src/win.c
@@ -21,6 +21,7 @@
#include "common.h"
#include "compiler.h"
#include "config.h"
+#include "dbus.h"
#include "list.h"
#include "log.h"
#include "picom.h"
@@ -34,10 +35,6 @@
#include "win_defs.h"
#include "x.h"
-#ifdef CONFIG_DBUS
-#include "dbus.h"
-#endif
-
#ifdef CONFIG_OPENGL
// TODO(yshui) Get rid of this include
#include "opengl.h"
@@ -1957,7 +1954,6 @@ static void win_on_focus_change(session_t *ps, struct managed_win *w) {
// Update everything related to conditions
win_on_factor_change(ps, w);
-#ifdef CONFIG_DBUS
// Send D-Bus signal
if (ps->o.dbus) {
if (win_is_focused_raw(w)) {
@@ -1966,7 +1962,6 @@ static void win_on_focus_change(session_t *ps, struct managed_win *w) {
cdbus_ev_win_focusout(ps, &w->base);
}
}
-#endif
}
/**
@@ -2392,12 +2387,10 @@ void destroy_win_start(session_t *ps, struct win *w) {
}
// don't need win_ev_stop because the window is gone anyway
-#ifdef CONFIG_DBUS
// Send D-Bus signal
if (ps->o.dbus) {
cdbus_ev_win_destroyed(ps, w);
}
-#endif
if (!ps->redirected && w->managed) {
// Skip transition if we are not rendering
@@ -2429,12 +2422,10 @@ void unmap_win_start(session_t *ps, struct managed_win *w) {
w->state = WSTATE_UNMAPPED;
win_start_fade(ps, w, 0);
-#ifdef CONFIG_DBUS
// Send D-Bus signal
if (ps->o.dbus) {
cdbus_ev_win_unmapped(ps, &w->base);
}
-#endif
if (!ps->redirected || !w->ever_damaged) {
// If we are not redirected, we skip fading because we aren't
@@ -2517,12 +2508,10 @@ void map_win_start(session_t *ps, struct managed_win *w) {
log_debug("Window %#010x has opacity %f, opacity target is %f", w->base.id,
animatable_get(&w->opacity), w->opacity.target);
-#ifdef CONFIG_DBUS
// Send D-Bus signal
if (ps->o.dbus) {
cdbus_ev_win_mapped(ps, &w->base);
}
-#endif
if (!ps->redirected) {
win_skip_fading(w);