mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-01-01 11:08:21 -05:00
Use env helpers
This commit is contained in:
parent
31a9fc1fb6
commit
8bd7170fd9
7 changed files with 70 additions and 96 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include "backend/backend.h"
|
||||
#include "backend/multi.h"
|
||||
#include "render/allocator/allocator.h"
|
||||
#include "util/env.h"
|
||||
|
||||
#if WLR_HAS_DRM_BACKEND
|
||||
#include <wlr/backend/drm.h>
|
||||
|
|
@ -364,8 +365,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
|
|||
}
|
||||
wlr_multi_backend_add(backend, libinput);
|
||||
#else
|
||||
const char *no_devs = getenv("WLR_LIBINPUT_NO_DEVICES");
|
||||
if (no_devs && strcmp(no_devs, "1") == 0) {
|
||||
if (env_parse_bool("WLR_LIBINPUT_NO_DEVICES")) {
|
||||
wlr_log(WLR_INFO, "WLR_LIBINPUT_NO_DEVICES is set, "
|
||||
"starting without libinput backend");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "render/drm_format_set.h"
|
||||
#include "render/swapchain.h"
|
||||
#include "render/wlr_renderer.h"
|
||||
#include "util/env.h"
|
||||
|
||||
// Output state which needs a KMS commit to be applied
|
||||
static const uint32_t COMMIT_OUTPUT_STATE =
|
||||
|
|
@ -74,8 +75,7 @@ bool check_drm_features(struct wlr_drm_backend *drm) {
|
|||
return false;
|
||||
}
|
||||
|
||||
const char *no_atomic = getenv("WLR_DRM_NO_ATOMIC");
|
||||
if (no_atomic && strcmp(no_atomic, "1") == 0) {
|
||||
if (env_parse_bool("WLR_DRM_NO_ATOMIC")) {
|
||||
wlr_log(WLR_DEBUG,
|
||||
"WLR_DRM_NO_ATOMIC set, forcing legacy DRM interface");
|
||||
drm->iface = &legacy_iface;
|
||||
|
|
@ -91,8 +91,7 @@ bool check_drm_features(struct wlr_drm_backend *drm) {
|
|||
int ret = drmGetCap(drm->fd, DRM_CAP_TIMESTAMP_MONOTONIC, &cap);
|
||||
drm->clock = (ret == 0 && cap == 1) ? CLOCK_MONOTONIC : CLOCK_REALTIME;
|
||||
|
||||
const char *no_modifiers = getenv("WLR_DRM_NO_MODIFIERS");
|
||||
if (no_modifiers != NULL && strcmp(no_modifiers, "1") == 0) {
|
||||
if (env_parse_bool("WLR_DRM_NO_MODIFIERS")) {
|
||||
wlr_log(WLR_DEBUG, "WLR_DRM_NO_MODIFIERS set, disabling modifiers");
|
||||
} else {
|
||||
ret = drmGetCap(drm->fd, DRM_CAP_ADDFB2_MODIFIERS, &cap);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <wlr/backend/session.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "backend/libinput.h"
|
||||
#include "util/env.h"
|
||||
|
||||
static struct wlr_libinput_backend *get_libinput_backend_from_backend(
|
||||
struct wlr_backend *wlr_backend) {
|
||||
|
|
@ -103,13 +104,8 @@ static bool backend_start(struct wlr_backend *wlr_backend) {
|
|||
libinput_log_set_priority(backend->libinput_context, LIBINPUT_LOG_PRIORITY_ERROR);
|
||||
|
||||
int libinput_fd = libinput_get_fd(backend->libinput_context);
|
||||
char *no_devs = getenv("WLR_LIBINPUT_NO_DEVICES");
|
||||
if (no_devs) {
|
||||
if (strcmp(no_devs, "1") != 0) {
|
||||
no_devs = NULL;
|
||||
}
|
||||
}
|
||||
if (!no_devs && wl_list_empty(&backend->devices)) {
|
||||
|
||||
if (!env_parse_bool("WLR_LIBINPUT_NO_DEVICES") && wl_list_empty(&backend->devices)) {
|
||||
handle_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend);
|
||||
if (wl_list_empty(&backend->devices)) {
|
||||
wlr_log(WLR_ERROR, "libinput initialization failed, no input devices");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue