diff options
| -rw-r--r-- | src/backend/tty.rs | 4 | ||||
| -rw-r--r-- | src/backend/winit.rs | 5 | ||||
| -rw-r--r-- | src/niri.rs | 14 |
3 files changed, 8 insertions, 15 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs index 75626898..1da682d8 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -39,7 +39,7 @@ use smithay_drm_extras::drm_scanner::{DrmScanEvent, DrmScanner}; use smithay_drm_extras::edid::EdidInfo; use crate::config::Config; -use crate::niri::{OutputRenderElements, State, RedrawState}; +use crate::niri::{OutputRenderElements, State, RedrawState, CLEAR_COLOR}; use crate::utils::get_monotonic_time; use crate::Niri; @@ -861,7 +861,7 @@ impl Tty { match drm_compositor.render_frame::<_, _, GlesTexture>( &mut device.gles, elements, - niri.clear_color(), + CLEAR_COLOR, ) { Ok(res) => { if self diff --git a/src/backend/winit.rs b/src/backend/winit.rs index 0188ea21..d818d76d 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -19,7 +19,7 @@ use smithay::utils::Transform; use super::RenderResult; use crate::config::Config; -use crate::niri::{OutputRenderElements, RedrawState, State}; +use crate::niri::{OutputRenderElements, RedrawState, State, CLEAR_COLOR}; use crate::utils::get_monotonic_time; use crate::Niri; @@ -157,10 +157,9 @@ impl Winit { self.backend.bind().unwrap(); let age = self.backend.buffer_age().unwrap(); - let clear_color = niri.clear_color(); let res = self .damage_tracker - .render_output(self.backend.renderer(), age, elements, clear_color) + .render_output(self.backend.renderer(), age, elements, CLEAR_COLOR) .unwrap(); niri.update_primary_scanout_output(output, &res.states); diff --git a/src/niri.rs b/src/niri.rs index b6109113..a5714286 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -84,6 +84,8 @@ use crate::layout::{output_size, Layout, MonitorRenderElement}; use crate::pw_utils::{Cast, PipeWire}; use crate::utils::{center, get_monotonic_time, make_screenshot_path}; +pub const CLEAR_COLOR: [f32; 4] = [0.2, 0.2, 0.2, 1.]; + pub struct Niri { pub config: Rc<RefCell<Config>>, @@ -888,10 +890,6 @@ impl Niri { }; } - pub fn clear_color(&self) -> [f32; 4] { - [0.1, 0.1, 0.1, 1.0] - } - pub fn pointer_element( &mut self, renderer: &mut GlesRenderer, @@ -1416,7 +1414,6 @@ impl Niri { let size = output.current_mode().unwrap().size; let scale = Scale::from(output.current_scale().fractional_scale()); - let clear_color = self.clear_color(); for cast in &mut self.casts { if !cast.is_active.get() { @@ -1452,9 +1449,7 @@ impl Niri { let dmabuf = cast.dmabufs.borrow()[&fd].clone(); // FIXME: Hidden / embedded / metadata cursor - if let Err(err) = - render_to_dmabuf(renderer, dmabuf, size, scale, clear_color, elements) - { + if let Err(err) = render_to_dmabuf(renderer, dmabuf, size, scale, elements) { error!("error rendering to dmabuf: {err:?}"); continue; } @@ -1737,7 +1732,6 @@ fn render_to_dmabuf( dmabuf: smithay::backend::allocator::dmabuf::Dmabuf, size: Size<i32, Physical>, scale: Scale<f64>, - clear_color: [f32; 4], elements: &[OutputRenderElements<GlesRenderer>], ) -> anyhow::Result<()> { use smithay::backend::renderer::element::Element; @@ -1752,7 +1746,7 @@ fn render_to_dmabuf( .context("error starting frame")?; frame - .clear(clear_color, &[output_rect]) + .clear(CLEAR_COLOR, &[output_rect]) .context("error clearing")?; for element in elements.iter().rev() { |
