Merge branch 'wscons' into 'master'

Draft: Add OpenBSD/wscons support

See merge request wlroots/wlroots!5378
This commit is contained in:
illiliti 2026-06-13 10:25:16 +00:00
commit 90cf273319
24 changed files with 1531 additions and 179 deletions

View file

@ -2,6 +2,31 @@
#define BACKEND_SESSION_SESSION_H
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include <xf86drm.h>
// for some reason libdrm does not define MAX3, but has defs that depend on it
#define MAX3(a, b, c) ((a) > (b) && (a) > (c) ? (a) : \
(b) > (c) ? (b) : (c))
struct drm_event_monitor;
enum drm_event_action {
DRM_EVENT_ACTION_NONE,
DRM_EVENT_ACTION_ADD,
DRM_EVENT_ACTION_CHANGE,
DRM_EVENT_ACTION_REMOVE,
};
struct drm_event_content {
char devnode[DRM_NODE_NAME_MAX];
dev_t devnum;
enum drm_event_action type;
int16_t conn_id;
int16_t prop_id;
bool has_lease;
};
struct wl_display;
struct wlr_session;
@ -17,4 +42,13 @@ void session_init(struct wlr_session *session);
struct wlr_device *session_open_if_kms(struct wlr_session *session,
const char *path);
struct drm_event_monitor *monitor_drm_events(int *fd);
void drm_event_monitor_free(struct drm_event_monitor *ctx);
int receive_drm_device(struct drm_event_monitor *ctx,
struct drm_event_content *ev);
const char *get_device_seat(struct drm_event_monitor *ctx, const char *devnode);
bool is_drm_device_primary(struct drm_event_monitor *ctx, const char *devnode);
#endif

32
include/backend/wscons.h Normal file
View file

@ -0,0 +1,32 @@
#ifndef BACKEND_WSCONS_H
#define BACKEND_WSCONS_H
#include <wayland-server-core.h>
#include <wlr/backend/interface.h>
#include <wlr/backend/wscons.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_pointer.h>
#include <wlr/backend/session.h>
struct wlr_wscons_backend {
struct wlr_backend backend;
struct wlr_device *mouse_dev;
struct wlr_device *kbd_dev;
struct wlr_keyboard kbd;
struct wlr_pointer mouse;
unsigned kbd_type;
int kqueue_fd;
struct wlr_session *session;
struct wl_event_source *input_event;
struct wl_listener session_destroy;
};
extern const struct wlr_keyboard_impl wscons_keyboard_impl;
extern const struct wlr_pointer_impl wscons_pointer_impl;
#endif