backend/wscons: introduce new backend

This commit is contained in:
illiliti 2026-05-22 15:48:18 +03:00
parent f56f21b98f
commit 900ff30921
12 changed files with 1208 additions and 7 deletions

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

View file

@ -23,6 +23,9 @@ endif
if not features.get('session')
exclude_files += 'backend/session.h'
endif
if not features.get('wscons-backend')
exclude_files += 'backend/wscons.h'
endif
install_subdir('wlr',
install_dir: get_option('includedir') / versioned_name,

View file

@ -0,0 +1,23 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_BACKEND_WSCONS_H
#define WLR_BACKEND_WSCONS_H
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/backend/session.h>
struct wlr_input_device;
struct wlr_backend *wlr_wscons_backend_create(struct wlr_session *session);
bool wlr_backend_is_wscons(const struct wlr_backend *backend);
bool wlr_input_device_is_wscons(struct wlr_input_device *device);
#endif

View file

@ -15,6 +15,13 @@
* Required for <wlr/backend/libinput.h>.
*/
#mesondefine WLR_HAS_LIBINPUT_BACKEND
/**
* Whether the wscons backend is compile-time enabled. Equivalent to the
* pkg-config "have_wscons_backend" vartiable.
*
* Required for <wlr/backend/wscons.h>.
*/
#mesondefine WLR_HAS_WSCONS_BACKEND
/**
* Whether the X11 backend is compile-time enabled. Equivalent to the
* pkg-config "have_x11_backend" variable.