From 27182b34439a4599821801d96b3c88f915938da6 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Fri, 11 Oct 2024 21:24:30 +0200 Subject: [PATCH] desktop: Do not warn about GameMode on non-Linux unless explicitly enabled This makes sure the warning is logged only when someone tries explicitly enabling GameMode. --- desktop/src/player.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/desktop/src/player.rs b/desktop/src/player.rs index ecc3f4ba7f56..542947c36ac9 100644 --- a/desktop/src/player.rs +++ b/desktop/src/player.rs @@ -264,18 +264,20 @@ impl ActivePlayer { } } + #[cfg_attr(not(target_os = "linux"), allow(unused))] let gamemode_enable = match preferences.gamemode_preference() { GameModePreference::Default => { preferences.graphics_power_preference() == PowerPreference::High } - GameModePreference::On => true, + GameModePreference::On => { + if cfg!(not(target_os = "linux")) { + tracing::warn!("Cannot enable GameMode, as it is supported only on Linux"); + } + true + } GameModePreference::Off => false, }; - if cfg!(not(target_os = "linux")) && gamemode_enable { - tracing::warn!("Cannot enable GameMode, as it is supported only on Linux"); - } - let renderer = WgpuRenderBackend::new(descriptors, movie_view) .map_err(|e| anyhow!(e.to_string())) .expect("Couldn't create wgpu rendering backend");