Add diagnostic logging to troubleshoot screenshot display issue

This commit is contained in:
2026-03-06 22:08:38 +01:00
parent 3637accaa6
commit 7cdcf19415
3 changed files with 38 additions and 30 deletions
+6 -5
View File
@@ -124,14 +124,15 @@ impl LockedSurface {
// Set background if available
if let Some(ref background) = self.background {
log::debug!(
"Applying background from self.background (size: {}x{})",
background.width(),
background.height()
let size = (background.width(), background.height());
log::info!(
"✓ Applying background from self.background: {}x{}",
size.0,
size.1
);
self.renderer.set_background(background.clone());
} else {
log::debug!("No background in self.background");
log::warn!("No background in self.background - will render solid color!");
}
self.renderer
+7 -6
View File
@@ -865,12 +865,14 @@ fn lock_wayland_session(
match state.screenshot_manager.as_ref().unwrap().buffer_to_surface(handle, &mut state.pool) {
Ok(surface) => {
log::info!("✓ Converted screenshot for output {}: {}x{}", output_idx, surface.width(), surface.height());
// Apply effects if configured
let mut screenshot = Screenshot::new(surface);
if let Err(e) = screenshot.apply_effects(&state.config) {
log::error!("Failed to apply effects: {}", e);
}
let surface = screenshot.into_inner();
log::info!("✓ Screenshot ready for output {}", output_idx);
// Save screenshot to file for debugging if debug mode enabled
if state.config.debug {
@@ -880,7 +882,7 @@ fn lock_wayland_session(
if let Err(e) = surface.write_to_png(&mut file) {
log::error!("Failed to write PNG to {}: {}", path, e);
} else {
log::info!("Saved screenshot to {}", path);
log::info!("Saved screenshot to {}", path);
}
}
Err(e) => {
@@ -893,15 +895,14 @@ fn lock_wayland_session(
let output = &state.outputs[output_idx];
if let Ok(mut lock_manager) = state.lock_manager.lock() {
if let Some(locked_surface) = lock_manager.find_surface_by_output(output) {
log::debug!("Setting background directly on lock surface for output {}", output_idx);
log::info!("Setting background on locked surface for output {}", output_idx);
locked_surface.set_background(surface);
log::debug!("Background set on surface");
} else {
log::debug!("Storing background in captured_backgrounds for output {}", output_idx);
log::warn!("⚠ No locked surface found for output {}, storing in captured_backgrounds", output_idx);
state.captured_backgrounds[output_idx] = Some(surface);
}
} else {
log::debug!("Failed to lock manager, storing background");
log::warn!("⚠ Lock manager poisoned, storing in captured_backgrounds for output {}", output_idx);
state.captured_backgrounds[output_idx] = Some(surface);
}
} else {
@@ -909,7 +910,7 @@ fn lock_wayland_session(
}
}
Err(e) => {
log::error!("Failed to convert buffer to surface: {}", e);
log::error!("Failed to convert buffer to surface: {}", e);
}
}
} else {
+10 -4
View File
@@ -92,7 +92,7 @@ impl Renderer {
/// Render the current frame
pub fn render(&mut self) {
log::debug!(
log::info!(
"Renderer::render() called, background: {}",
self.background.is_some()
);
@@ -103,17 +103,23 @@ impl Renderer {
// Draw background if available
if let Some(ref background) = self.background {
log::debug!("Drawing background (fade_alpha: {})", self.fade_alpha);
let size = (background.width(), background.height());
log::info!(
"✓ Drawing background ({}x{}, fade_alpha: {})",
size.0,
size.1,
self.fade_alpha
);
self.context
.set_source_surface(background, 0.0, 0.0)
.expect("Failed to set background source");
self.context
.paint_with_alpha(self.fade_alpha)
.expect("Failed to draw background");
log::debug!("Background drawn");
log::info!("Background drawn successfully");
} else {
// Draw solid color background (dark gray visible color)
log::debug!("No background, drawing solid color");
log::warn!("No background available - rendering solid gray!");
self.context.set_source_rgba(0.15, 0.15, 0.15, 1.0);
self.context
.paint()