chore: cleanup platform specific code

This commit is contained in:
Ashley Wulber 2026-03-30 15:19:39 -04:00 committed by Ashley Wulber
parent a11b828280
commit 3b7f0bec0e
18 changed files with 109 additions and 101 deletions

View file

@ -9,7 +9,12 @@ use crate::graphics::{self, Shell, Viewport};
use crate::settings::{self, Settings};
use crate::{Engine, Renderer};
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
#[cfg(all(
unix,
feature = "cctk",
not(target_os = "macos"),
not(target_os = "redox")
))]
use super::wayland::get_wayland_device_ids;
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
use super::x11::get_x11_device_ids;
@ -60,7 +65,12 @@ impl Compositor {
compatible_window: Option<W>,
shell: Shell,
) -> Result<Self, Error> {
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
#[cfg(all(
unix,
feature = "cctk",
not(target_os = "macos"),
not(target_os = "redox")
))]
let ids = compatible_window.as_ref().and_then(|window| {
get_wayland_device_ids(window)
.or_else(|| get_x11_device_ids(window))
@ -72,7 +82,12 @@ impl Compositor {
// 3. and the user didn't set an adapter name,
// 4. and the user didn't request the high power pref
// => don't load the nvidia icd, as it might power on the gpu in hybrid setups causing severe delays
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
#[cfg(all(
unix,
feature = "cctk",
not(target_os = "macos"),
not(target_os = "redox")
))]
if !matches!(ids, Some((0x10de, _)))
&& std::env::var_os("__NV_PRIME_RENDER_OFFLOAD")
.is_none_or(|var| var == "0")
@ -133,6 +148,7 @@ impl Compositor {
if std::env::var_os("WGPU_ADAPTER_NAME").is_none() {
#[cfg(all(
unix,
feature = "cctk",
not(target_os = "macos"),
not(target_os = "redox")
))]