mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
backend/session/libseat: register log handler
Route libseat errors through wlroots logging infrastructure. This requires libseat 0.2.0.
This commit is contained in:
parent
65abd4e92a
commit
971de474f0
2 changed files with 26 additions and 1 deletions
|
@ -62,6 +62,28 @@ static struct libseat_session *libseat_session_from_session(
|
||||||
return (struct libseat_session *)base;
|
return (struct libseat_session *)base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum wlr_log_importance libseat_log_level_to_wlr(
|
||||||
|
enum libseat_log_level level) {
|
||||||
|
switch (level) {
|
||||||
|
case LIBSEAT_LOG_LEVEL_ERROR:
|
||||||
|
return WLR_ERROR;
|
||||||
|
case LIBSEAT_LOG_LEVEL_INFO:
|
||||||
|
return WLR_INFO;
|
||||||
|
default:
|
||||||
|
return WLR_DEBUG;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void log_libseat(enum libseat_log_level level,
|
||||||
|
const char *fmt, va_list args) {
|
||||||
|
enum wlr_log_importance importance = libseat_log_level_to_wlr(level);
|
||||||
|
|
||||||
|
static char wlr_fmt[1024];
|
||||||
|
snprintf(wlr_fmt, sizeof(wlr_fmt), "[libseat] %s", fmt);
|
||||||
|
|
||||||
|
_wlr_vlog(importance, wlr_fmt, args);
|
||||||
|
}
|
||||||
|
|
||||||
static struct wlr_session *libseat_session_create(struct wl_display *disp) {
|
static struct wlr_session *libseat_session_create(struct wl_display *disp) {
|
||||||
struct libseat_session *session = calloc(1, sizeof(*session));
|
struct libseat_session *session = calloc(1, sizeof(*session));
|
||||||
if (!session) {
|
if (!session) {
|
||||||
|
@ -72,6 +94,9 @@ static struct wlr_session *libseat_session_create(struct wl_display *disp) {
|
||||||
session_init(&session->base);
|
session_init(&session->base);
|
||||||
wl_list_init(&session->devices);
|
wl_list_init(&session->devices);
|
||||||
|
|
||||||
|
libseat_set_log_handler(log_libseat);
|
||||||
|
libseat_set_log_level(LIBSEAT_LOG_LEVEL_ERROR);
|
||||||
|
|
||||||
session->seat = libseat_open_seat(&seat_listener, session);
|
session->seat = libseat_open_seat(&seat_listener, session);
|
||||||
if (session->seat == NULL) {
|
if (session->seat == NULL) {
|
||||||
wlr_log_errno(WLR_ERROR, "Unable to create seat");
|
wlr_log_errno(WLR_ERROR, "Unable to create seat");
|
||||||
|
|
|
@ -65,7 +65,7 @@ endif
|
||||||
|
|
||||||
# libseat
|
# libseat
|
||||||
|
|
||||||
libseat = dependency('libseat', required: get_option('libseat'))
|
libseat = dependency('libseat', required: get_option('libseat'), version: '>=0.2.0')
|
||||||
if libseat.found()
|
if libseat.found()
|
||||||
wlr_files += files('libseat.c')
|
wlr_files += files('libseat.c')
|
||||||
wlr_deps += libseat
|
wlr_deps += libseat
|
||||||
|
|
Loading…
Reference in a new issue