From daf03b423d57ce063f109ff826c4274f2d73e9ac Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Sun, 4 Feb 2024 20:16:59 +0100 Subject: [PATCH] render: don't warn when rendering an unmapped sub-surface --- src/ifs/wl_surface/cursor.rs | 10 +++++++++- src/renderer.rs | 6 ++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ifs/wl_surface/cursor.rs b/src/ifs/wl_surface/cursor.rs index 99df51df..78709a38 100644 --- a/src/ifs/wl_surface/cursor.rs +++ b/src/ifs/wl_surface/cursor.rs @@ -76,7 +76,15 @@ impl Cursor for CursorSurface { let (hot_x, hot_y) = (Fixed::from_int(hot_x), Fixed::from_int(hot_y)); let x = ((x - hot_x).to_f64() * scale).round() as _; let y = ((y - hot_y).to_f64() * scale).round() as _; - renderer.render_surface_scaled(&self.surface, x, y, None, i32::MAX, i32::MAX); + renderer.render_surface_scaled( + &self.surface, + x, + y, + None, + i32::MAX, + i32::MAX, + false, + ); } else { renderer.render_surface( &self.surface, diff --git a/src/renderer.rs b/src/renderer.rs index 69f9a0b6..2eabb3da 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -307,7 +307,7 @@ impl Renderer<'_> { max_height: i32, ) { let (x, y) = self.base.scale_point(x, y); - self.render_surface_scaled(surface, x, y, None, max_width, max_height); + self.render_surface_scaled(surface, x, y, None, max_width, max_height, false); } pub fn render_surface_scaled( @@ -318,12 +318,13 @@ impl Renderer<'_> { pos_rel: Option<(i32, i32)>, max_width: i32, max_height: i32, + is_subsurface: bool, ) { let children = surface.children.borrow(); let buffer = match surface.buffer.get() { Some(b) => b, _ => { - if !surface.is_cursor() { + if !surface.is_cursor() && !is_subsurface { log::warn!("surface has no buffer attached"); } return; @@ -354,6 +355,7 @@ impl Renderer<'_> { Some((pos.x1(), pos.y1())), max_width, max_height, + true, ); } };