From 57a09c8ca45e0ec023b7be88745b21fc71649c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Tue, 26 Dec 2017 18:51:27 +0100 Subject: [PATCH] config: Put all defines into config.h --- backend/session/direct-ipc.c | 3 ++- backend/session/logind.c | 5 +++-- backend/session/session.c | 5 +++-- examples/support/config.c | 2 +- include/rootston/desktop.h | 3 ++- include/rootston/server.h | 3 ++- include/rootston/view.h | 5 +++-- include/wlr/xwayland.h | 3 ++- meson.build | 12 ++++++------ rootston/config.c | 1 + rootston/desktop.c | 3 ++- rootston/main.c | 3 ++- rootston/seat.c | 1 + rootston/xwayland.c | 3 ++- types/wlr_xdg_shell_v6.c | 1 + xwayland/xwm.c | 7 ++++--- 16 files changed, 37 insertions(+), 23 deletions(-) diff --git a/backend/session/direct-ipc.c b/backend/session/direct-ipc.c index 0ea51e2f1..52cdbbb9e 100644 --- a/backend/session/direct-ipc.c +++ b/backend/session/direct-ipc.c @@ -18,12 +18,13 @@ #include #endif #include +#include "config.h" #include #include "backend/session/direct-ipc.h" enum { DRM_MAJOR = 226 }; -#ifdef HAS_LIBCAP +#ifdef WLR_HAS_LIBCAP #include static bool have_permissions(void) { diff --git a/backend/session/logind.c b/backend/session/logind.c index e9d4c8f36..539490dec 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -10,13 +10,14 @@ #include #include #include +#include "config.h" #include #include -#ifdef HAS_SYSTEMD +#ifdef WLR_HAS_SYSTEMD #include #include -#elif HAS_ELOGIND +#elif WLR_HAS_ELOGIND #include #include #endif diff --git a/backend/session/session.c b/backend/session/session.c index 0ed544992..725aa1b9a 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -9,6 +9,7 @@ #include #include #include +#include "config.h" #include #include #include @@ -17,9 +18,9 @@ extern const struct session_impl session_logind; extern const struct session_impl session_direct; static const struct session_impl *impls[] = { -#ifdef HAS_SYSTEMD +#ifdef WLR_HAS_SYSTEMD &session_logind, -#elif HAS_ELOGIND +#elif WLR_HAS_ELOGIND &session_logind, #endif &session_direct, diff --git a/examples/support/config.c b/examples/support/config.c index 0ef025c0d..ff63b0783 100644 --- a/examples/support/config.c +++ b/examples/support/config.c @@ -7,10 +7,10 @@ #include #include #include +#include "config.h" #include #include #include "shared.h" -#include "config.h" #include "ini.h" static void usage(const char *name, int ret) { diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index 289875c50..7039cfcfe 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -2,6 +2,7 @@ #define _ROOTSTON_DESKTOP_H #include #include +#include "config.h" #include #include #include @@ -50,7 +51,7 @@ struct roots_desktop { struct wl_listener wl_shell_surface; struct wl_listener decoration_new; -#ifdef HAS_XWAYLAND +#ifdef WLR_HAS_XWAYLAND struct wlr_xwayland *xwayland; struct wl_listener xwayland_surface; struct wl_listener xwayland_ready; diff --git a/include/rootston/server.h b/include/rootston/server.h index 8fc6530ec..a014c7499 100644 --- a/include/rootston/server.h +++ b/include/rootston/server.h @@ -1,11 +1,12 @@ #ifndef _ROOTSTON_SERVER_H #define _ROOTSTON_SERVER_H #include +#include "config.h" #include #include #include #include -#ifdef HAS_XWAYLAND +#ifdef WLR_HAS_XWAYLAND #include #endif #include "rootston/config.h" diff --git a/include/rootston/view.h b/include/rootston/view.h index bb7297d0e..53e967641 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -2,6 +2,7 @@ #define _ROOTSTON_VIEW_H #include +#include "config.h" #include #include #include @@ -79,14 +80,14 @@ struct roots_view { union { struct wlr_wl_shell_surface *wl_shell_surface; struct wlr_xdg_surface_v6 *xdg_surface_v6; -#ifdef HAS_XWAYLAND +#ifdef WLR_HAS_XWAYLAND struct wlr_xwayland_surface *xwayland_surface; #endif }; union { struct roots_wl_shell_surface *roots_wl_shell_surface; struct roots_xdg_surface_v6 *roots_xdg_surface_v6; -#ifdef HAS_XWAYLAND +#ifdef WLR_HAS_XWAYLAND struct roots_xwayland_surface *roots_xwayland_surface; #endif }; diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index acf045959..230cfeed0 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -3,11 +3,12 @@ #include #include +#include "config.h" #include #include #include -#ifdef HAS_XCB_ICCCM +#ifdef WLR_HAS_XCB_ICCCM #include #endif diff --git a/meson.build b/meson.build index a3f5e7f9e..51de7a4c3 100644 --- a/meson.build +++ b/meson.build @@ -24,6 +24,8 @@ add_project_link_arguments( language: 'c', ) +conf_data = configuration_data() + wlr_inc = include_directories('include') cc = meson.get_compiler('c') @@ -63,26 +65,24 @@ elogind = dependency('libelogind', required: false) math = cc.find_library('m', required: false) if xcb_icccm.found() - add_project_arguments('-DHAS_XCB_ICCCM', language: 'c') + conf_data.set('WLR_HAS_XCB_ICCCM', true) endif if libcap.found() and get_option('enable_libcap') - add_project_arguments('-DHAS_LIBCAP', language: 'c') + conf_data.set('WLR_HAS_LIBCAP', true) endif if systemd.found() and get_option('enable_systemd') - add_project_arguments('-DHAS_SYSTEMD', language: 'c') + conf_data.set('WLR_HAS_SYSTEMD', true) endif if elogind.found() and get_option('enable_elogind') - add_project_arguments('-DHAS_ELOGIND', language: 'c') + conf_data.set('WLR_HAS_ELOGIND', true) endif exclude_files = [] wlr_parts = [] -conf_data = configuration_data() if get_option('enable_xwayland') - add_project_arguments('-DHAS_XWAYLAND', language: 'c') subdir('xwayland') wlr_parts += [lib_wlr_xwayland] conf_data.set('WLR_HAS_XWAYLAND', true) diff --git a/rootston/config.c b/rootston/config.c index dd7411864..f369c4f5f 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -9,6 +9,7 @@ #include #include #include +#include "config.h" #include #include #include "rootston/config.h" diff --git a/rootston/desktop.c b/rootston/desktop.c index 1431dc5d2..a46924392 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -3,6 +3,7 @@ #include #include #include +#include "config.h" #include #include #include @@ -440,7 +441,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, &desktop->wl_shell_surface); desktop->wl_shell_surface.notify = handle_wl_shell_surface; -#ifdef HAS_XWAYLAND +#ifdef WLR_HAS_XWAYLAND if (config->xwayland) { desktop->xwayland = wlr_xwayland_create(server->wl_display, desktop->compositor); diff --git a/rootston/main.c b/rootston/main.c index 161824d6e..87f1c0b4f 100644 --- a/rootston/main.c +++ b/rootston/main.c @@ -3,6 +3,7 @@ #include #include #include +#include "config.h" #include #include #include @@ -64,7 +65,7 @@ int main(int argc, char **argv) { } setenv("WAYLAND_DISPLAY", socket, true); -#ifndef HAS_XWAYLAND +#ifndef WLR_HAS_XWAYLAND ready(NULL, NULL); #else if (server.desktop->xwayland != NULL) { diff --git a/rootston/seat.c b/rootston/seat.c index ce0f13748..635bc8b17 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -2,6 +2,7 @@ #include #include #include +#include "config.h" #include #include #include "rootston/xcursor.h" diff --git a/rootston/xwayland.c b/rootston/xwayland.c index 5f677116d..b00b61bc9 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -2,11 +2,12 @@ #include #include #include +#include "config.h" #include #include #include #include -#include "rootston/desktop.h" +#include "rootston/server.h" #include "rootston/server.h" static void activate(struct roots_view *view, bool active) { diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index 23d36b6f4..e288883d3 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -5,6 +5,7 @@ #include #include #include +#include "config.h" #include #include #include diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 6cbe9bda7..f373e128b 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -7,6 +7,7 @@ #include #include #include +#include "config.h" #include "wlr/util/log.h" #include "wlr/util/edges.h" #include "wlr/types/wlr_surface.h" @@ -14,7 +15,7 @@ #include "wlr/xcursor.h" #include "wlr/xwm.h" -#ifdef HAS_XCB_ICCCM +#ifdef WLR_HAS_XCB_ICCCM #include #endif @@ -365,7 +366,7 @@ static void read_surface_protocols(struct wlr_xwm *xwm, wlr_log(L_DEBUG, "WM_PROTOCOLS (%zu)", atoms_len); } -#ifdef HAS_XCB_ICCCM +#ifdef WLR_HAS_XCB_ICCCM static void read_surface_hints(struct wlr_xwm *xwm, struct wlr_xwayland_surface *xsurface, xcb_get_property_reply_t *reply) { @@ -396,7 +397,7 @@ static void read_surface_hints(struct wlr_xwm *xwm, } #endif -#ifdef HAS_XCB_ICCCM +#ifdef WLR_HAS_XCB_ICCCM static void read_surface_normal_hints(struct wlr_xwm *xwm, struct wlr_xwayland_surface *xsurface, xcb_get_property_reply_t *reply) {