mirror of https://github.com/yshui/picom.git
dbus: add stubs for when dbus support is disabled
So we can reduce the number of ifdefs used. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
ce5197a491
commit
e4edd33c74
11
src/common.h
11
src/common.h
|
@ -503,17 +503,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 <code>bool</code> array of all wintypes to true.
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
29
src/dbus.h
29
src/dbus.h
|
@ -11,11 +11,11 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
typedef struct session session_t;
|
||||
struct win;
|
||||
|
||||
#ifdef CONFIG_DBUS
|
||||
#include <dbus/dbus.h>
|
||||
/**
|
||||
* 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 :
|
||||
|
|
39
src/picom.c
39
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) \
|
||||
|
@ -1187,23 +1185,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)
|
||||
*
|
||||
|
@ -1647,12 +1628,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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
13
src/win.c
13
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"
|
||||
|
@ -1995,7 +1992,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)) {
|
||||
|
@ -2004,7 +2000,6 @@ static void win_on_focus_change(session_t *ps, struct managed_win *w) {
|
|||
cdbus_ev_win_focusout(ps, &w->base);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2441,12 +2436,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
|
||||
|
@ -2478,12 +2471,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
|
||||
|
@ -2566,12 +2557,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);
|
||||
|
|
Loading…
Reference in New Issue