mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-24 06:59:45 -05:00
Use env helpers
This commit is contained in:
parent
31a9fc1fb6
commit
8bd7170fd9
7 changed files with 70 additions and 96 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include "render/allocator/allocator.h"
|
||||
#include "render/swapchain.h"
|
||||
#include "types/wlr_output.h"
|
||||
#include "util/env.h"
|
||||
#include "util/global.h"
|
||||
|
||||
#define OUTPUT_VERSION 4
|
||||
|
|
@ -366,11 +367,9 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
|||
wl_signal_init(&output->events.destroy);
|
||||
output_state_init(&output->pending);
|
||||
|
||||
const char *no_hardware_cursors = getenv("WLR_NO_HARDWARE_CURSORS");
|
||||
if (no_hardware_cursors != NULL && strcmp(no_hardware_cursors, "1") == 0) {
|
||||
wlr_log(WLR_DEBUG,
|
||||
"WLR_NO_HARDWARE_CURSORS set, forcing software cursors");
|
||||
output->software_cursor_locks = 1;
|
||||
output->software_cursor_locks = env_parse_bool("WLR_NO_HARDWARE_CURSORS");
|
||||
if (output->software_cursor_locks) {
|
||||
wlr_log(WLR_DEBUG, "WLR_NO_HARDWARE_CURSORS set, forcing software cursors");
|
||||
}
|
||||
|
||||
wlr_addon_set_init(&output->addons);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "types/wlr_buffer.h"
|
||||
#include "types/wlr_scene.h"
|
||||
#include "util/array.h"
|
||||
#include "util/env.h"
|
||||
#include "util/time.h"
|
||||
|
||||
#define HIGHLIGHT_DAMAGE_FADEOUT_TIME 250
|
||||
|
|
@ -150,49 +151,16 @@ struct wlr_scene *wlr_scene_create(void) {
|
|||
wl_list_init(&scene->outputs);
|
||||
wl_list_init(&scene->presentation_destroy.link);
|
||||
|
||||
char *debug_damage = getenv("WLR_SCENE_DEBUG_DAMAGE");
|
||||
if (debug_damage) {
|
||||
wlr_log(WLR_INFO, "Loading WLR_SCENE_DEBUG_DAMAGE option: %s", debug_damage);
|
||||
}
|
||||
const char *debug_damage_options[] = {
|
||||
"none",
|
||||
"rerender",
|
||||
"highlight",
|
||||
NULL
|
||||
};
|
||||
|
||||
if (!debug_damage || strcmp(debug_damage, "none") == 0) {
|
||||
scene->debug_damage_option = WLR_SCENE_DEBUG_DAMAGE_NONE;
|
||||
} else if (strcmp(debug_damage, "rerender") == 0) {
|
||||
scene->debug_damage_option = WLR_SCENE_DEBUG_DAMAGE_RERENDER;
|
||||
} else if (strcmp(debug_damage, "highlight") == 0) {
|
||||
scene->debug_damage_option = WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT;
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "Unknown WLR_SCENE_DEBUG_DAMAGE option: %s", debug_damage);
|
||||
scene->debug_damage_option = WLR_SCENE_DEBUG_DAMAGE_NONE;
|
||||
}
|
||||
|
||||
char *disable_direct_scanout = getenv("WLR_SCENE_DISABLE_DIRECT_SCANOUT");
|
||||
if (disable_direct_scanout) {
|
||||
wlr_log(WLR_INFO, "Loading WLR_SCENE_DISABLE_DIRECT_SCANOUT option: %s", disable_direct_scanout);
|
||||
}
|
||||
|
||||
if (!disable_direct_scanout || strcmp(disable_direct_scanout, "0") == 0) {
|
||||
scene->direct_scanout = true;
|
||||
} else if (strcmp(disable_direct_scanout, "1") == 0) {
|
||||
scene->direct_scanout = false;
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "Unknown WLR_SCENE_DISABLE_DIRECT_SCANOUT option: %s", disable_direct_scanout);
|
||||
scene->direct_scanout = true;
|
||||
}
|
||||
|
||||
char *visibility_disabled = getenv("WLR_SCENE_DISABLE_VISIBILITY");
|
||||
if (visibility_disabled) {
|
||||
wlr_log(WLR_INFO, "Loading WLR_SCENE_DISABLE_VISIBILITY option: %s", visibility_disabled);
|
||||
}
|
||||
|
||||
if (!visibility_disabled || strcmp(visibility_disabled, "0") == 0) {
|
||||
scene->calculate_visibility = true;
|
||||
} else if (strcmp(visibility_disabled, "1") == 0) {
|
||||
scene->calculate_visibility = false;
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "Unknown WLR_SCENE_DISABLE_VISIBILITY option: %s", visibility_disabled);
|
||||
scene->calculate_visibility = true;
|
||||
}
|
||||
scene->debug_damage_option = env_parse_switch("WLR_SCENE_DEBUG_DAMAGE", debug_damage_options);
|
||||
scene->direct_scanout = !env_parse_bool("WLR_SCENE_DISABLE_DIRECT_SCANOUT");
|
||||
scene->calculate_visibility = !env_parse_bool("WLR_SCENE_DISABLE_VISIBILITY");
|
||||
|
||||
return scene;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue