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)
|
/// Update the surface state (called on each frame)
|
||||||
pub fn update(&mut self) {
|
pub fn update(&mut self) {
|
||||||
|
log::debug!(
|
||||||
|
"LockedSurface::update() called, background: {}",
|
||||||
|
self.background.is_some()
|
||||||
|
);
|
||||||
|
|
||||||
// Update timers
|
// Update timers
|
||||||
self.input_handler.update();
|
self.input_handler.update();
|
||||||
|
|
||||||
@@ -81,21 +86,26 @@ impl LockedSurface {
|
|||||||
let fade_duration = std::time::Duration::from_secs_f32(self.config.fade_in);
|
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.fade_alpha = (elapsed.as_secs_f64() / fade_duration.as_secs_f64()).min(1.0);
|
||||||
self.renderer.set_fade_alpha(self.fade_alpha);
|
self.renderer.set_fade_alpha(self.fade_alpha);
|
||||||
|
log::debug!("Fade alpha updated: {}", self.fade_alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update visual feedback
|
// Update visual feedback
|
||||||
if self.input_handler.should_show_wrong_password() && !self.wrong_password_shown {
|
if self.input_handler.should_show_wrong_password() && !self.wrong_password_shown {
|
||||||
self.renderer.show_wrong_password();
|
self.renderer.show_wrong_password();
|
||||||
self.wrong_password_shown = true;
|
self.wrong_password_shown = true;
|
||||||
|
log::debug!("Showing wrong password feedback");
|
||||||
} else if !self.input_handler.should_show_wrong_password() && self.wrong_password_shown {
|
} else if !self.input_handler.should_show_wrong_password() && self.wrong_password_shown {
|
||||||
self.wrong_password_shown = false;
|
self.wrong_password_shown = false;
|
||||||
|
log::debug!("Hiding wrong password feedback");
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.input_handler.should_show_key_highlight() && !self.key_highlight_shown {
|
if self.input_handler.should_show_key_highlight() && !self.key_highlight_shown {
|
||||||
self.renderer.show_key_highlight();
|
self.renderer.show_key_highlight();
|
||||||
self.key_highlight_shown = true;
|
self.key_highlight_shown = true;
|
||||||
|
log::debug!("Showing key highlight");
|
||||||
} else if !self.input_handler.should_show_key_highlight() && self.key_highlight_shown {
|
} else if !self.input_handler.should_show_key_highlight() && self.key_highlight_shown {
|
||||||
self.key_highlight_shown = false;
|
self.key_highlight_shown = false;
|
||||||
|
log::debug!("Hiding key highlight");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle temp screenshot (peek feature)
|
// Handle temp screenshot (peek feature)
|
||||||
@@ -104,15 +114,24 @@ impl LockedSurface {
|
|||||||
// For now, we'll just set a different background alpha
|
// For now, we'll just set a different background alpha
|
||||||
self.renderer.set_fade_alpha(0.3); // Semi-transparent
|
self.renderer.set_fade_alpha(0.3); // Semi-transparent
|
||||||
self.temp_screenshot_shown = true;
|
self.temp_screenshot_shown = true;
|
||||||
|
log::debug!("Showing temp screenshot (peek)");
|
||||||
} else if !self.input_handler.should_show_temp_screenshot() && self.temp_screenshot_shown {
|
} else if !self.input_handler.should_show_temp_screenshot() && self.temp_screenshot_shown {
|
||||||
// Restore normal fade alpha
|
// Restore normal fade alpha
|
||||||
self.renderer.set_fade_alpha(self.fade_alpha);
|
self.renderer.set_fade_alpha(self.fade_alpha);
|
||||||
self.temp_screenshot_shown = false;
|
self.temp_screenshot_shown = false;
|
||||||
|
log::debug!("Restored normal fade alpha after peek");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set background if available
|
// Set background if available
|
||||||
if let Some(ref background) = self.background {
|
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());
|
self.renderer.set_background(background.clone());
|
||||||
|
} else {
|
||||||
|
log::debug!("No background in self.background");
|
||||||
}
|
}
|
||||||
|
|
||||||
self.renderer
|
self.renderer
|
||||||
|
|||||||
+9
-1
@@ -888,6 +888,7 @@ fn lock_wayland_session(
|
|||||||
if let Some(locked_surface) = lock_manager.find_surface_by_output(output) {
|
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::debug!("Setting background directly on lock surface for output {}", output_idx);
|
||||||
locked_surface.set_background(surface);
|
locked_surface.set_background(surface);
|
||||||
|
log::debug!("Background set on surface");
|
||||||
} else {
|
} else {
|
||||||
log::debug!("Storing background in captured_backgrounds for output {}", output_idx);
|
log::debug!("Storing background in captured_backgrounds for output {}", output_idx);
|
||||||
state.captured_backgrounds[output_idx] = Some(surface);
|
state.captured_backgrounds[output_idx] = Some(surface);
|
||||||
@@ -987,6 +988,7 @@ fn lock_wayland_session(
|
|||||||
event_loop.handle().insert_source(
|
event_loop.handle().insert_source(
|
||||||
render_timer,
|
render_timer,
|
||||||
|_event, _metadata, state: &mut WaylandLock| {
|
|_event, _metadata, state: &mut WaylandLock| {
|
||||||
|
log::debug!("Timer tick");
|
||||||
// Update lock manager (renders to Cairo surfaces)
|
// Update lock manager (renders to Cairo surfaces)
|
||||||
if let Ok(mut lock_manager) = state.lock_manager.lock() {
|
if let Ok(mut lock_manager) = state.lock_manager.lock() {
|
||||||
lock_manager.update();
|
lock_manager.update();
|
||||||
@@ -995,9 +997,15 @@ fn lock_wayland_session(
|
|||||||
if let Some(_wl_surface) = surface.wayland_surface() {
|
if let Some(_wl_surface) = surface.wayland_surface() {
|
||||||
if let Err(e) = surface.commit(&mut state.pool) {
|
if let Err(e) = surface.commit(&mut state.pool) {
|
||||||
log::error!("Failed to commit surface: {:?}", e);
|
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)
|
// Reschedule timer to fire again in 16ms (60fps)
|
||||||
calloop::timer::TimeoutAction::ToDuration(Duration::from_millis(16))
|
calloop::timer::TimeoutAction::ToDuration(Duration::from_millis(16))
|
||||||
|
|||||||
@@ -92,20 +92,28 @@ impl Renderer {
|
|||||||
|
|
||||||
/// Render the current frame
|
/// Render the current frame
|
||||||
pub fn render(&mut self) {
|
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
|
// 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.set_source_rgba(0.15, 0.15, 0.15, 1.0);
|
||||||
self.context.paint().expect("Failed to clear surface");
|
self.context.paint().expect("Failed to clear surface");
|
||||||
|
|
||||||
// Draw background if available
|
// Draw background if available
|
||||||
if let Some(ref background) = self.background {
|
if let Some(ref background) = self.background {
|
||||||
|
log::debug!("Drawing background (fade_alpha: {})", self.fade_alpha);
|
||||||
self.context
|
self.context
|
||||||
.set_source_surface(background, 0.0, 0.0)
|
.set_source_surface(background, 0.0, 0.0)
|
||||||
.expect("Failed to set background source");
|
.expect("Failed to set background source");
|
||||||
self.context
|
self.context
|
||||||
.paint_with_alpha(self.fade_alpha)
|
.paint_with_alpha(self.fade_alpha)
|
||||||
.expect("Failed to draw background");
|
.expect("Failed to draw background");
|
||||||
|
log::debug!("Background drawn");
|
||||||
} else {
|
} else {
|
||||||
// Draw solid color background (dark gray visible color)
|
// 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.set_source_rgba(0.15, 0.15, 0.15, 1.0);
|
||||||
self.context
|
self.context
|
||||||
.paint()
|
.paint()
|
||||||
|
|||||||
Reference in New Issue
Block a user