Add comprehensive debug logging for screenshot rendering
- Timer callback: log each tick and commit status - LockedSurface::update(): log background presence, fade alpha, feedback states - Renderer::render(): log background drawing and fade alpha - Ready event: log background set confirmation These logs will help diagnose why screenshots are not displaying.
This commit is contained in:
+19
@@ -72,6 +72,11 @@ impl LockedSurface {
|
||||
|
||||
/// Update the surface state (called on each frame)
|
||||
pub fn update(&mut self) {
|
||||
log::debug!(
|
||||
"LockedSurface::update() called, background: {}",
|
||||
self.background.is_some()
|
||||
);
|
||||
|
||||
// Update timers
|
||||
self.input_handler.update();
|
||||
|
||||
@@ -81,21 +86,26 @@ impl LockedSurface {
|
||||
let fade_duration = std::time::Duration::from_secs_f32(self.config.fade_in);
|
||||
self.fade_alpha = (elapsed.as_secs_f64() / fade_duration.as_secs_f64()).min(1.0);
|
||||
self.renderer.set_fade_alpha(self.fade_alpha);
|
||||
log::debug!("Fade alpha updated: {}", self.fade_alpha);
|
||||
}
|
||||
|
||||
// Update visual feedback
|
||||
if self.input_handler.should_show_wrong_password() && !self.wrong_password_shown {
|
||||
self.renderer.show_wrong_password();
|
||||
self.wrong_password_shown = true;
|
||||
log::debug!("Showing wrong password feedback");
|
||||
} else if !self.input_handler.should_show_wrong_password() && self.wrong_password_shown {
|
||||
self.wrong_password_shown = false;
|
||||
log::debug!("Hiding wrong password feedback");
|
||||
}
|
||||
|
||||
if self.input_handler.should_show_key_highlight() && !self.key_highlight_shown {
|
||||
self.renderer.show_key_highlight();
|
||||
self.key_highlight_shown = true;
|
||||
log::debug!("Showing key highlight");
|
||||
} else if !self.input_handler.should_show_key_highlight() && self.key_highlight_shown {
|
||||
self.key_highlight_shown = false;
|
||||
log::debug!("Hiding key highlight");
|
||||
}
|
||||
|
||||
// Handle temp screenshot (peek feature)
|
||||
@@ -104,15 +114,24 @@ impl LockedSurface {
|
||||
// For now, we'll just set a different background alpha
|
||||
self.renderer.set_fade_alpha(0.3); // Semi-transparent
|
||||
self.temp_screenshot_shown = true;
|
||||
log::debug!("Showing temp screenshot (peek)");
|
||||
} else if !self.input_handler.should_show_temp_screenshot() && self.temp_screenshot_shown {
|
||||
// Restore normal fade alpha
|
||||
self.renderer.set_fade_alpha(self.fade_alpha);
|
||||
self.temp_screenshot_shown = false;
|
||||
log::debug!("Restored normal fade alpha after peek");
|
||||
}
|
||||
|
||||
// Set background if available
|
||||
if let Some(ref background) = self.background {
|
||||
log::debug!(
|
||||
"Applying background from self.background (size: {}x{})",
|
||||
background.width(),
|
||||
background.height()
|
||||
);
|
||||
self.renderer.set_background(background.clone());
|
||||
} else {
|
||||
log::debug!("No background in self.background");
|
||||
}
|
||||
|
||||
self.renderer
|
||||
|
||||
+15
-7
@@ -885,13 +885,14 @@ fn lock_wayland_session(
|
||||
if output_idx < state.outputs.len() {
|
||||
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);
|
||||
locked_surface.set_background(surface);
|
||||
} else {
|
||||
log::debug!("Storing background in captured_backgrounds for output {}", output_idx);
|
||||
state.captured_backgrounds[output_idx] = Some(surface);
|
||||
}
|
||||
if let Some(locked_surface) = lock_manager.find_surface_by_output(output) {
|
||||
log::debug!("Setting background directly on lock 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);
|
||||
state.captured_backgrounds[output_idx] = Some(surface);
|
||||
}
|
||||
} else {
|
||||
log::debug!("Failed to lock manager, storing background");
|
||||
state.captured_backgrounds[output_idx] = Some(surface);
|
||||
@@ -987,6 +988,7 @@ fn lock_wayland_session(
|
||||
event_loop.handle().insert_source(
|
||||
render_timer,
|
||||
|_event, _metadata, state: &mut WaylandLock| {
|
||||
log::debug!("Timer tick");
|
||||
// Update lock manager (renders to Cairo surfaces)
|
||||
if let Ok(mut lock_manager) = state.lock_manager.lock() {
|
||||
lock_manager.update();
|
||||
@@ -995,9 +997,15 @@ fn lock_wayland_session(
|
||||
if let Some(_wl_surface) = surface.wayland_surface() {
|
||||
if let Err(e) = surface.commit(&mut state.pool) {
|
||||
log::error!("Failed to commit surface: {:?}", e);
|
||||
} else {
|
||||
log::debug!("Committed surface");
|
||||
}
|
||||
} else {
|
||||
log::debug!("Surface has no wayland_surface");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log::error!("Failed to lock lock_manager mutex - poisoned?");
|
||||
}
|
||||
// Reschedule timer to fire again in 16ms (60fps)
|
||||
calloop::timer::TimeoutAction::ToDuration(Duration::from_millis(16))
|
||||
|
||||
@@ -92,20 +92,28 @@ impl Renderer {
|
||||
|
||||
/// Render the current frame
|
||||
pub fn render(&mut self) {
|
||||
log::debug!(
|
||||
"Renderer::render() called, background: {}",
|
||||
self.background.is_some()
|
||||
);
|
||||
|
||||
// Clear the surface - draw a VISIBLE color (dark gray) instead of black
|
||||
self.context.set_source_rgba(0.15, 0.15, 0.15, 1.0);
|
||||
self.context.paint().expect("Failed to clear surface");
|
||||
|
||||
// Draw background if available
|
||||
if let Some(ref background) = self.background {
|
||||
log::debug!("Drawing background (fade_alpha: {})", 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");
|
||||
} else {
|
||||
// Draw solid color background (dark gray visible color)
|
||||
log::debug!("No background, drawing solid color");
|
||||
self.context.set_source_rgba(0.15, 0.15, 0.15, 1.0);
|
||||
self.context
|
||||
.paint()
|
||||
|
||||
Reference in New Issue
Block a user