diff options
author | Simon Ser <contact@emersion.fr> | 2022-11-23 16:04:43 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-11-25 16:15:29 +0000 |
commit | f0375eed24276e27e036f724c9fde5d344fc140a (patch) | |
tree | 32732996951bd290acd3ba12084ab42778134073 /backend | |
parent | 21254737bf97e5be44071063c14fce5a403a9a22 (diff) |
backend/session: make optional
Some compositors are not interested in wlr_session, for instance
nested compositors.
Disabling wlr_session removes the udev dependency.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/backend.c | 13 | ||||
-rw-r--r-- | backend/drm/meson.build | 4 | ||||
-rw-r--r-- | backend/libinput/meson.build | 2 | ||||
-rw-r--r-- | backend/meson.build | 15 | ||||
-rw-r--r-- | backend/session/meson.build | 11 |
5 files changed, 37 insertions, 8 deletions
diff --git a/backend/backend.c b/backend/backend.c index de25f347..a0ed834b 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -9,7 +9,6 @@ #include <wlr/backend/headless.h> #include <wlr/backend/interface.h> #include <wlr/backend/multi.h> -#include <wlr/backend/session.h> #include <wlr/backend/wayland.h> #include <wlr/config.h> #include <wlr/render/wlr_renderer.h> @@ -20,6 +19,10 @@ #include "util/env.h" #include "util/time.h" +#if WLR_HAS_SESSION +#include <wlr/backend/session.h> +#endif + #if WLR_HAS_DRM_BACKEND #include <wlr/backend/drm.h> #include "backend/drm/monitor.h" @@ -67,6 +70,7 @@ void wlr_backend_destroy(struct wlr_backend *backend) { } } +#if WLR_HAS_SESSION static struct wlr_session *session_create_and_wait(struct wl_display *disp) { struct wlr_session *session = wlr_session_create(disp); @@ -106,6 +110,7 @@ static struct wlr_session *session_create_and_wait(struct wl_display *disp) { return session; } +#endif clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend) { if (backend->impl->get_presentation_clock) { @@ -247,7 +252,9 @@ static bool attempt_backend_by_name(struct wl_display *display, } else if (strcmp(name, "drm") == 0 || strcmp(name, "libinput") == 0) { // DRM and libinput need a session if (*session_ptr == NULL) { +#if WLR_HAS_SESSION *session_ptr = session_create_and_wait(display); +#endif if (*session_ptr == NULL) { wlr_log(WLR_ERROR, "failed to start a session"); return false; @@ -343,7 +350,9 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display, #endif // Attempt DRM+libinput +#if WLR_HAS_SESSION session = session_create_and_wait(display); +#endif if (!session) { wlr_log(WLR_ERROR, "Failed to start a DRM session"); goto error; @@ -388,6 +397,8 @@ success: error: wlr_backend_destroy(multi); +#if WLR_HAS_SESSION wlr_session_destroy(session); +#endif return NULL; } diff --git a/backend/drm/meson.build b/backend/drm/meson.build index 7bde50c2..fc4d84d6 100644 --- a/backend/drm/meson.build +++ b/backend/drm/meson.build @@ -1,3 +1,7 @@ +if not features['session'] + subdir_done() +endif + hwdata = dependency('hwdata', required: false, native: true) if hwdata.found() hwdata_dir = hwdata.get_variable(pkgconfig: 'pkgdatadir') diff --git a/backend/libinput/meson.build b/backend/libinput/meson.build index 2f3ccab3..181eb04b 100644 --- a/backend/libinput/meson.build +++ b/backend/libinput/meson.build @@ -10,7 +10,7 @@ libinput = dependency( not_found_message: '\n'.join(msg), ) -if not libinput.found() +if not (libinput.found() and features['session']) subdir_done() endif diff --git a/backend/meson.build b/backend/meson.build index b5b6f7a6..ed977d3b 100644 --- a/backend/meson.build +++ b/backend/meson.build @@ -1,6 +1,3 @@ -udev = dependency('libudev') -wlr_deps += udev - wlr_files += files('backend.c') all_backends = ['drm', 'libinput', 'x11'] @@ -11,6 +8,16 @@ elif 'auto' in backends and get_option('auto_features').disabled() backends = [] endif +session_required = 'drm' in backends or 'libinput' in backends or get_option('session').enabled() +if get_option('session').disabled() + if session_required + error('Session support is required for the DRM or libinput backends') + endif + session_required = disabler() +endif + +subdir('session') + foreach backend : all_backends if backend in backends or 'auto' in backends subdir(backend) @@ -20,5 +27,3 @@ endforeach subdir('multi') subdir('wayland') subdir('headless') - -subdir('session') diff --git a/backend/session/meson.build b/backend/session/meson.build index 9e35ef1e..4c20ee9d 100644 --- a/backend/session/meson.build +++ b/backend/session/meson.build @@ -1,8 +1,17 @@ +msg = 'Required for session support.' +udev = dependency('libudev', required: session_required, not_found_message: msg) libseat = dependency( 'libseat', version: '>=0.2.0', fallback: 'seatd', default_options: ['server=disabled', 'man-pages=disabled', 'examples=disabled'], + required: session_required, + not_found_message: msg, ) +if not (udev.found() and libseat.found()) + subdir_done() +endif + wlr_files += files('session.c') -wlr_deps += libseat +wlr_deps += [udev, libseat] +features += { 'session': true } |