backend/session: wire up openbsd support

This commit is contained in:
illiliti 2026-05-23 09:03:13 +03:00
parent 326bd749ee
commit f56f21b98f
2 changed files with 57 additions and 7 deletions

View file

@ -1,18 +1,27 @@
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()
platform = target_machine.system()
if platform == 'linux' or platform == 'freebsd'
libudev = dependency('libudev', required: session_required)
if not (libudev.found() and libseat.found())
subdir_done()
endif
wlr_files += files('session_libudev.c')
wlr_deps += libudev
elif platform == 'openbsd'
wlr_files += files('session_openbsd.c')
else
error('Unsupported platform')
endif
wlr_files += files('session.c')
wlr_files += files('session_libudev.c')
wlr_deps += [udev, libseat]
wlr_deps += libseat
features += { 'session': true }

View file

@ -0,0 +1,41 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#include "backend/session/session.h"
struct drm_event_monitor {
int fd;
};
// TODO: use kqueue NOTE_CHANGE mechanism
struct drm_event_monitor *monitor_drm_events(int *fd) {
struct drm_event_monitor *ctx = calloc(1, sizeof(struct drm_event_monitor));
if (!ctx) {
return NULL;
}
ctx->fd = open("/dev/null", O_RDONLY);
if (ctx->fd == -1) {
free(ctx);
return NULL;
}
*fd = ctx->fd;
return ctx;
}
void drm_event_monitor_free(struct drm_event_monitor *ctx) {
close(ctx->fd);
free(ctx);
}
int receive_drm_device(struct drm_event_monitor *ctx,
struct drm_event_content *ev) {
return -1;
}
const char *get_device_seat(struct drm_event_monitor *ctx, const char *devnode) {
return NULL;
}
bool is_drm_device_primary(struct drm_event_monitor *ctx, const char *devnode) {
return false;
}