Skip to content

Commit

Permalink
config: Put all defines into config.h
Browse files Browse the repository at this point in the history
  • Loading branch information
besser82 committed Dec 26, 2017
1 parent 4d744ae commit 57a09c8
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 23 deletions.
3 changes: 2 additions & 1 deletion backend/session/direct-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
#include <linux/major.h>
#endif
#include <xf86drm.h>
#include "config.h"
#include <wlr/util/log.h>
#include "backend/session/direct-ipc.h"

enum { DRM_MAJOR = 226 };

#ifdef HAS_LIBCAP
#ifdef WLR_HAS_LIBCAP
#include <sys/capability.h>

static bool have_permissions(void) {
Expand Down
5 changes: 3 additions & 2 deletions backend/session/logind.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <wayland-server.h>
#include "config.h"
#include <wlr/backend/session/interface.h>
#include <wlr/util/log.h>

#ifdef HAS_SYSTEMD
#ifdef WLR_HAS_SYSTEMD
#include <systemd/sd-bus.h>
#include <systemd/sd-login.h>
#elif HAS_ELOGIND
#elif WLR_HAS_ELOGIND
#include <elogind/sd-bus.h>
#include <elogind/sd-login.h>
#endif
Expand Down
5 changes: 3 additions & 2 deletions backend/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <wayland-server.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
#include "config.h"
#include <wlr/backend/session.h>
#include <wlr/backend/session/interface.h>
#include <wlr/util/log.h>
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion examples/support/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include <string.h>
#include <unistd.h>
#include <sys/param.h>
#include "config.h"
#include <wlr/util/log.h>
#include <wlr/types/wlr_box.h>
#include "shared.h"
#include "config.h"
#include "ini.h"

static void usage(const char *name, int ret) {
Expand Down
3 changes: 2 additions & 1 deletion include/rootston/desktop.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _ROOTSTON_DESKTOP_H
#include <time.h>
#include <wayland-server.h>
#include "config.h"
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_compositor.h>
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion include/rootston/server.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#ifndef _ROOTSTON_SERVER_H
#define _ROOTSTON_SERVER_H
#include <wayland-server.h>
#include "config.h"
#include <wlr/backend.h>
#include <wlr/backend/session.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/render.h>
#ifdef HAS_XWAYLAND
#ifdef WLR_HAS_XWAYLAND
#include <wlr/xwayland.h>
#endif
#include "rootston/config.h"
Expand Down
5 changes: 3 additions & 2 deletions include/rootston/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _ROOTSTON_VIEW_H

#include <stdbool.h>
#include "config.h"
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
Expand Down Expand Up @@ -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
};
Expand Down
3 changes: 2 additions & 1 deletion include/wlr/xwayland.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

#include <time.h>
#include <stdbool.h>
#include "config.h"
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_seat.h>
#include <xcb/xcb.h>

#ifdef HAS_XCB_ICCCM
#ifdef WLR_HAS_XCB_ICCCM
#include <xcb/xcb_icccm.h>
#endif

Expand Down
12 changes: 6 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ add_project_link_arguments(
language: 'c',
)

conf_data = configuration_data()

wlr_inc = include_directories('include')

cc = meson.get_compiler('c')
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions rootston/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <strings.h>
#include <unistd.h>
#include <sys/param.h>
#include "config.h"
#include <wlr/util/log.h>
#include <wlr/types/wlr_box.h>
#include "rootston/config.h"
Expand Down
3 changes: 2 additions & 1 deletion rootston/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <time.h>
#include <stdlib.h>
#include <math.h>
#include "config.h"
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_cursor.h>
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion rootston/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <wayland-server.h>
#include "config.h"
#include <wlr/backend.h>
#include <wlr/backend/headless.h>
#include <wlr/backend/multi.h>
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions rootston/seat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <wayland-server.h>
#include "config.h"
#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/util/log.h>
#include "rootston/xcursor.h"
Expand Down
3 changes: 2 additions & 1 deletion rootston/xwayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#include <stdlib.h>
#include <stdbool.h>
#include <wayland-server.h>
#include "config.h"
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/xwayland.h>
#include <wlr/util/log.h>
#include "rootston/desktop.h"
#include "rootston/server.h"
#include "rootston/server.h"

static void activate(struct roots_view *view, bool active) {
Expand Down
1 change: 1 addition & 0 deletions types/wlr_xdg_shell_v6.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include <wayland-server.h>
#include "config.h"
#include <wlr/types/wlr_xdg_shell_v6.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_seat.h>
Expand Down
7 changes: 4 additions & 3 deletions xwayland/xwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
#include <xcb/xfixes.h>
#include <xcb/xcb_image.h>
#include <xcb/render.h>
#include "config.h"
#include "wlr/util/log.h"
#include "wlr/util/edges.h"
#include "wlr/types/wlr_surface.h"
#include "wlr/xwayland.h"
#include "wlr/xcursor.h"
#include "wlr/xwm.h"

#ifdef HAS_XCB_ICCCM
#ifdef WLR_HAS_XCB_ICCCM
#include <xcb/xcb_icccm.h>
#endif

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 57a09c8

Please sign in to comment.