From 175f89f4ffdf65a53c0c55e8c3ef6256ac57b29c Mon Sep 17 00:00:00 2001 From: dudemanguy Date: Fri, 22 Sep 2017 12:02:55 -0500 Subject: [PATCH] Add elogind support Resolves SirCmpwn/wlroots#146 --- README.md | 1 + backend/meson.build | 6 +++++- backend/session/logind.c | 10 ++++++++-- backend/session/session.c | 2 ++ meson.build | 5 +++++ meson_options.txt | 1 + 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6ccef6bc..6f7418a1 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Install dependencies: * udev * pixman * systemd (optional, for logind support) +* elogind (optional, for logind support) * libcap (optional, for capability support) * asciidoc (optional, for man pages) diff --git a/backend/meson.build b/backend/meson.build index eb8c5d8b..a3cb7b64 100644 --- a/backend/meson.build +++ b/backend/meson.build @@ -28,9 +28,13 @@ if systemd.found() backend_files += files('session/logind.c') endif +if elogind.found() + backend_files += files('session/logind.c') +endif + lib_wlr_backend = static_library( 'wlr_backend', backend_files, include_directories: wlr_inc, - dependencies: [wayland_server, egl, gbm, libinput, systemd, wlr_protos], + dependencies: [wayland_server, egl, gbm, libinput, systemd, elogind, wlr_protos], ) diff --git a/backend/session/logind.c b/backend/session/logind.c index 3b237360..42b48e94 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -15,6 +13,14 @@ #include #include +#ifdef HAS_SYSTEMD + #include + #include +#elif HAS_ELOGIND + #include + #include +#endif + enum { DRM_MAJOR = 226 }; const struct session_impl session_logind; diff --git a/backend/session/session.c b/backend/session/session.c index c9bc1397..cfa617f6 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -18,6 +18,8 @@ extern const struct session_impl session_direct; static const struct session_impl *impls[] = { #ifdef HAS_SYSTEMD &session_logind, +#elif HAS_ELOGIND + &session_logind, #endif &session_direct, NULL, diff --git a/meson.build b/meson.build index ceded2d1..4a3c670a 100644 --- a/meson.build +++ b/meson.build @@ -46,6 +46,7 @@ xcb = dependency('xcb') xcb_composite = dependency('xcb-composite') libcap = dependency('libcap', required: false) systemd = dependency('libsystemd', required: false) +elogind = dependency('libelogind', required: false) math = cc.find_library('m', required: false) if libcap.found() and get_option('enable_libcap') @@ -56,6 +57,10 @@ if systemd.found() and get_option('enable_systemd') add_project_arguments('-DHAS_SYSTEMD', language: 'c') endif +if elogind.found() and get_option('enable_elogind') + add_project_arguments('-DHAS_ELOGIND', language: 'c') +endif + subdir('protocol') subdir('backend') subdir('render') diff --git a/meson_options.txt b/meson_options.txt index ab74eec1..a3f9ca45 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,3 @@ option('enable_libcap', type: 'boolean', value: true, description: 'Enable support for capabilities') option('enable_systemd', type: 'boolean', value: true, description: 'Enable support for logind') +option('enable_elogind', type: 'boolean', value: true, description: 'Enable support for logind')