chore: delete dead code and correct stale dead_code annotations
Review-verified deletions, each confirmed unreferenced by grep and by a
clean warning-free build of both feature sets:
- assets/icons/*.svg: leftovers from the embedded-SVG era, referenced
nowhere since the switch to procedural painters
- five toolbar_icons wrappers whose "referenced by the toolbar-gtk
frontend only" comments were false - the GTK frontend uses
draw_icon_pin/draw_icon_unpin directly
- the capture status channel: an Arc<Mutex<CaptureStatus>> plus
get_status() with zero production consumers - the UI reads
CapturePoll exclusively, and every test assertion on it duplicated
an outcome assertion the same test already made
- is_clipboard_available ("Phase 2" scaffolding with no callers),
resolve_damage_regions (only its own tests called it),
invalidate_help_overlay_cache (dead, and redundant - the cache key
already includes the style), invalidate_text_cache (exported, never
called)
Stale annotations corrected so the compiler can resume catching real
rot: pointer-constraints fields were annotated "kept for potential
future pointer lock support" while pointer lock uses them today;
manager_available, log_dir, save_snapshot, load_snapshot, and
AUTOSAVE_HISTORY_FALLBACK_DEPTH carried allows despite live callers;
pointer press named a parameter _conn and used it four times.
No files matched your search
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-right-icon lucide-arrow-up-right"><path d="M7 7h10v10"/><path d="M7 17 17 7"/></svg>
|
||||
|
Before Width: | Height: | Size: 295 B |
@@ -1,8 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="4" y="4" width="16" height="16" rx="3"/>
|
||||
<circle cx="9" cy="9" r="1.2" fill="currentColor" stroke="none"/>
|
||||
<circle cx="15" cy="9" r="1.2" fill="currentColor" stroke="none" opacity="0.75"/>
|
||||
<circle cx="12" cy="12" r="1.6" fill="currentColor" stroke="none"/>
|
||||
<circle cx="9" cy="15" r="1.2" fill="currentColor" stroke="none" opacity="0.75"/>
|
||||
<circle cx="15" cy="15" r="1.2" fill="currentColor" stroke="none"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 617 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-icon lucide-circle"><circle cx="12" cy="12" r="10"/></svg>
|
||||
|
Before Width: | Height: | Size: 267 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-eraser-icon lucide-eraser"><path d="M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21"/><path d="m5.082 11.09 8.828 8.828"/></svg>
|
||||
|
Before Width: | Height: | Size: 402 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-highlighter-icon lucide-highlighter"><path d="m9 11-6 6v3h9l3-3"/><path d="m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"/></svg>
|
||||
|
Before Width: | Height: | Size: 346 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-list-ordered-icon lucide-list-ordered"><path d="M11 5h10"/><path d="M11 12h10"/><path d="M11 19h10"/><path d="M4 4h1v5"/><path d="M4 9h2"/><path d="M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"/></svg>
|
||||
|
Before Width: | Height: | Size: 415 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-minus-icon lucide-minus"><path d="M5 12h14"/></svg>
|
||||
|
Before Width: | Height: | Size: 253 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-mouse-pointer-click-icon lucide-mouse-pointer-click"><path d="M14 4.1 12 6"/><path d="m5.1 8-2.9-.8"/><path d="m6 12-1.9 2"/><path d="M7.2 2.2 8 5.1"/><path d="M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z"/></svg>
|
||||
|
Before Width: | Height: | Size: 496 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-mouse-pointer-icon lucide-mouse-pointer"><path d="M12.586 12.586 19 19"/><path d="M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z"/></svg>
|
||||
|
Before Width: | Height: | Size: 433 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pen-tool-icon lucide-pen-tool"><path d="M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z"/><path d="m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18"/><path d="m2.3 2.3 7.286 7.286"/><circle cx="11" cy="11" r="2"/></svg>
|
||||
|
Before Width: | Height: | Size: 559 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pen-icon lucide-pen"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/></svg>
|
||||
|
Before Width: | Height: | Size: 369 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rectangle-horizontal-icon lucide-rectangle-horizontal"><rect width="20" height="12" x="2" y="6" rx="2"/></svg>
|
||||
|
Before Width: | Height: | Size: 312 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sticky-note-icon lucide-sticky-note"><path d="M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z"/><path d="M15 3v5a1 1 0 0 0 1 1h5"/></svg>
|
||||
|
Before Width: | Height: | Size: 405 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-type-icon lucide-type"><path d="M12 4v16"/><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"/><path d="M9 20h6"/></svg>
|
||||
|
Before Width: | Height: | Size: 321 B |
@@ -83,7 +83,6 @@ impl FrozenState {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn manager_available(&self) -> bool {
|
||||
self.manager.is_some()
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ use super::*;
|
||||
impl WaylandState {
|
||||
pub(super) fn handle_pointer_press(
|
||||
&mut self,
|
||||
_conn: &wayland_client::Connection,
|
||||
conn: &wayland_client::Connection,
|
||||
qh: &QueueHandle<Self>,
|
||||
event: &PointerEvent,
|
||||
on_toolbar: bool,
|
||||
@@ -120,13 +120,12 @@ impl WaylandState {
|
||||
// Inline bars share the canvas surface, so their swatch recolor
|
||||
// gesture is resolved here rather than in the `on_toolbar` branch.
|
||||
if button == BTN_RIGHT
|
||||
&& self.inline_toolbar_secondary_press(event.position, Some(_conn), Some(qh))
|
||||
&& self.inline_toolbar_secondary_press(event.position, Some(conn), Some(qh))
|
||||
{
|
||||
self.refresh_keyboard_interactivity();
|
||||
return;
|
||||
}
|
||||
if button == BTN_LEFT
|
||||
&& self.inline_toolbar_press(event.position, Some(_conn), Some(qh))
|
||||
if button == BTN_LEFT && self.inline_toolbar_press(event.position, Some(conn), Some(qh))
|
||||
{
|
||||
drag_log(format!(
|
||||
"pointer press: inline handled, drag_active={}, pos=({:.3}, {:.3}), surface={}",
|
||||
@@ -158,7 +157,7 @@ impl WaylandState {
|
||||
{
|
||||
self.handle_toolbar_event(
|
||||
ToolbarEvent::EditQuickColor { index },
|
||||
Some(_conn),
|
||||
Some(conn),
|
||||
Some(qh),
|
||||
);
|
||||
self.toolbar.mark_dirty();
|
||||
@@ -188,7 +187,7 @@ impl WaylandState {
|
||||
self.inline_toolbars_active()
|
||||
);
|
||||
self.set_toolbar_dragging(drag);
|
||||
self.handle_toolbar_event(toolbar_event, Some(_conn), Some(qh));
|
||||
self.handle_toolbar_event(toolbar_event, Some(conn), Some(qh));
|
||||
self.toolbar.mark_dirty();
|
||||
self.input_state.needs_redraw = true;
|
||||
self.refresh_keyboard_interactivity();
|
||||
|
||||
@@ -183,9 +183,9 @@ pub(super) struct WaylandState {
|
||||
pub(super) xdg_shell: Option<XdgShell>,
|
||||
pub(super) activation: Option<ActivationState>,
|
||||
pub(super) shm: Shm,
|
||||
#[allow(dead_code)] // Kept for potential future pointer lock support
|
||||
// Both drive pointer lock for toolbar drags; see
|
||||
// state/toolbar/visibility/pointer.rs.
|
||||
pub(super) pointer_constraints_state: PointerConstraintsState,
|
||||
#[allow(dead_code)] // Kept for potential future pointer lock support
|
||||
pub(super) relative_pointer_state: RelativePointerState,
|
||||
pub(super) output_state: OutputState,
|
||||
pub(super) seat_state: SeatState,
|
||||
|
||||
@@ -9,26 +9,6 @@ use crate::env_vars::{
|
||||
};
|
||||
use crate::{config::Config, util::Rect};
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(in crate::backend::wayland) fn resolve_damage_regions(
|
||||
width: i32,
|
||||
height: i32,
|
||||
mut regions: Vec<Rect>,
|
||||
) -> Vec<Rect> {
|
||||
regions.retain(Rect::is_valid);
|
||||
|
||||
if regions.is_empty()
|
||||
&& width > 0
|
||||
&& height > 0
|
||||
&& let Some(full) = Rect::new(0, 0, width, height)
|
||||
{
|
||||
regions.push(full);
|
||||
}
|
||||
|
||||
regions
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(in crate::backend::wayland) fn scale_damage_regions(
|
||||
regions: Vec<Rect>,
|
||||
scale: i32,
|
||||
|
||||
@@ -2,59 +2,9 @@ use super::helpers;
|
||||
use super::*;
|
||||
use crate::util::Rect;
|
||||
|
||||
// NOTE: The renderer now uses per-buffer damage tracking via BufferDamageTracker.
|
||||
// NOTE: The renderer uses per-buffer damage tracking via BufferDamageTracker.
|
||||
// Each buffer slot is tracked by its canvas memory address (stable across SlotPool
|
||||
// reuse), ensuring correct incremental damage with multi-buffering. These helper
|
||||
// functions are used for diagnostic logging and damage region processing.
|
||||
#[test]
|
||||
fn resolve_damage_returns_full_when_empty() {
|
||||
let regions = helpers::resolve_damage_regions(1920, 1080, Vec::new());
|
||||
assert_eq!(regions.len(), 1);
|
||||
assert_eq!(regions[0], Rect::new(0, 0, 1920, 1080).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_damage_filters_invalid_rects() {
|
||||
let regions = helpers::resolve_damage_regions(
|
||||
800,
|
||||
600,
|
||||
vec![
|
||||
Rect {
|
||||
x: 10,
|
||||
y: 10,
|
||||
width: 50,
|
||||
height: 40,
|
||||
},
|
||||
Rect {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 10,
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
assert_eq!(regions.len(), 1);
|
||||
assert_eq!(regions[0], Rect::new(10, 10, 50, 40).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_damage_preserves_existing_regions() {
|
||||
let regions = helpers::resolve_damage_regions(
|
||||
800,
|
||||
600,
|
||||
vec![Rect {
|
||||
x: 5,
|
||||
y: 5,
|
||||
width: 20,
|
||||
height: 30,
|
||||
}],
|
||||
);
|
||||
|
||||
assert_eq!(regions.len(), 1);
|
||||
assert_eq!(regions[0], Rect::new(5, 5, 20, 30).unwrap());
|
||||
}
|
||||
|
||||
// reuse), ensuring correct incremental damage with multi-buffering.
|
||||
#[test]
|
||||
fn per_buffer_damage_tracking_is_implemented() {
|
||||
// The BufferDamageTracker tracks damage per buffer slot using the canvas
|
||||
@@ -146,8 +96,8 @@ fn damage_summary_truncates_after_five_regions() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_then_scale_damage_regions_keeps_full_region() {
|
||||
let regions = helpers::resolve_damage_regions(100, 50, Vec::new());
|
||||
fn scale_damage_regions_scales_by_buffer_scale() {
|
||||
let regions = vec![Rect::new(0, 0, 100, 50).unwrap()];
|
||||
let scaled = scale_damage_regions(regions, 2);
|
||||
assert_eq!(scaled.len(), 1);
|
||||
assert_eq!(scaled[0], Rect::new(0, 0, 200, 100).unwrap());
|
||||
|
||||
@@ -262,12 +262,6 @@ impl SurfaceState {
|
||||
self.frame_callbacks.is_pending()
|
||||
}
|
||||
|
||||
/// Returns the current pool generation counter.
|
||||
#[allow(dead_code)]
|
||||
pub fn pool_generation(&self) -> u64 {
|
||||
self.pool_generation
|
||||
}
|
||||
|
||||
/// Updates the stored pool size and returns true if it grew.
|
||||
///
|
||||
/// Call this after `create_buffer` to detect if the pool grew during allocation.
|
||||
|
||||
@@ -64,38 +64,12 @@ fn copy_via_command(image_data: &[u8]) -> Result<(), CaptureError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Check if clipboard functionality is available.
|
||||
///
|
||||
/// Tests if wl-copy command exists as a basic availability check.
|
||||
#[allow(dead_code)] // Will be used in Phase 2 for capability checks
|
||||
pub fn is_clipboard_available() -> bool {
|
||||
crate::process_broker::current()
|
||||
.and_then(|broker| {
|
||||
broker.run(
|
||||
crate::process_broker::HelperKind::WlCopy,
|
||||
OsStr::new("wl-copy"),
|
||||
[OsStr::new("--version")],
|
||||
Vec::new(),
|
||||
Duration::from_secs(2),
|
||||
4096,
|
||||
)
|
||||
})
|
||||
.is_ok_and(|output| !output.timed_out && output.status == 0)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[test]
|
||||
fn test_is_clipboard_available() {
|
||||
// This test will pass or fail depending on system setup
|
||||
// Just ensure it doesn't panic
|
||||
let _available = is_clipboard_available();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn copy_to_clipboard_uses_command_success() {
|
||||
let cmd_calls = Rc::new(Cell::new(0));
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::capture::{
|
||||
deliver_image, perform_capture, render_and_deliver_document, render_and_deliver_image,
|
||||
},
|
||||
types::{
|
||||
CaptureDestination, CaptureError, CaptureOutcome, CaptureStatus, CaptureType,
|
||||
CaptureDestination, CaptureError, CaptureOutcome, CaptureType,
|
||||
DesktopBackdropCaptureRequest, DocumentDeliveryRequest, ImageDeliveryRequest,
|
||||
ImageOperationKind, RenderedDocumentDeliveryRequest, RenderedImageDeliveryRequest,
|
||||
},
|
||||
@@ -115,7 +115,6 @@ pub struct CaptureManager {
|
||||
terminal_reported: bool,
|
||||
shutdown_requested: Arc<AtomicBool>,
|
||||
worker: Option<tokio::task::JoinHandle<()>>,
|
||||
status: Arc<tokio::sync::Mutex<CaptureStatus>>,
|
||||
}
|
||||
|
||||
impl CaptureManager {
|
||||
@@ -164,12 +163,10 @@ impl CaptureManager {
|
||||
) -> Self {
|
||||
let (request_tx, request_rx) = mpsc::channel::<CaptureCommand>(1);
|
||||
let (completion_tx, completion_rx) = std::sync::mpsc::sync_channel(1);
|
||||
let status = Arc::new(tokio::sync::Mutex::new(CaptureStatus::Idle));
|
||||
let shutdown_requested = Arc::new(AtomicBool::new(false));
|
||||
let worker = runtime_handle.spawn(run_capture_worker(
|
||||
request_rx,
|
||||
completion_tx,
|
||||
Arc::clone(&status),
|
||||
Arc::new(dependencies),
|
||||
notifier,
|
||||
Arc::clone(&shutdown_requested),
|
||||
@@ -184,7 +181,6 @@ impl CaptureManager {
|
||||
terminal_reported: false,
|
||||
shutdown_requested,
|
||||
worker: Some(worker),
|
||||
status,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,11 +342,6 @@ impl CaptureManager {
|
||||
self.disable_worker();
|
||||
}
|
||||
|
||||
/// Gets the current informational capture status.
|
||||
pub async fn get_status(&self) -> CaptureStatus {
|
||||
self.status.lock().await.clone()
|
||||
}
|
||||
|
||||
/// Stops the owned worker without reporting normal teardown as failure.
|
||||
pub fn shutdown(&mut self) {
|
||||
self.shutdown_requested.store(true, Ordering::Release);
|
||||
@@ -380,7 +371,6 @@ impl Drop for CaptureManager {
|
||||
async fn run_capture_worker(
|
||||
mut request_rx: mpsc::Receiver<CaptureCommand>,
|
||||
completion_tx: SyncSender<CaptureCompletion>,
|
||||
status: Arc<tokio::sync::Mutex<CaptureStatus>>,
|
||||
dependencies: Arc<CaptureDependencies>,
|
||||
notifier: CompletionNotifier,
|
||||
shutdown_requested: Arc<AtomicBool>,
|
||||
@@ -393,7 +383,6 @@ async fn run_capture_worker(
|
||||
command.request
|
||||
);
|
||||
let operation = command.request.operation();
|
||||
*status.lock().await = CaptureStatus::AwaitingPermission;
|
||||
|
||||
let result = match command.request {
|
||||
CaptureManagerRequest::Capture(request) => {
|
||||
@@ -427,7 +416,7 @@ async fn run_capture_worker(
|
||||
.map(CaptureManagerResult::Capture)
|
||||
}
|
||||
};
|
||||
let outcome = outcome_and_status(result, operation, &status).await;
|
||||
let outcome = outcome_from_result(result, operation);
|
||||
if !guard.publish(CaptureCompletion {
|
||||
id: command.id,
|
||||
outcome,
|
||||
@@ -437,31 +426,26 @@ async fn run_capture_worker(
|
||||
}
|
||||
}
|
||||
|
||||
async fn outcome_and_status(
|
||||
fn outcome_from_result(
|
||||
result: Result<CaptureManagerResult, CaptureError>,
|
||||
operation: ImageOperationKind,
|
||||
status: &tokio::sync::Mutex<CaptureStatus>,
|
||||
) -> CaptureOutcome {
|
||||
match result {
|
||||
Ok(CaptureManagerResult::Capture(result)) => {
|
||||
log::info!("Image operation successful: {:?}", result.saved_path);
|
||||
*status.lock().await = CaptureStatus::Success;
|
||||
CaptureOutcome::Success(result)
|
||||
}
|
||||
Ok(CaptureManagerResult::DesktopBackdrop(result)) => {
|
||||
log::info!("Desktop backdrop capture successful");
|
||||
*status.lock().await = CaptureStatus::Success;
|
||||
CaptureOutcome::DesktopBackdropSuccess(result)
|
||||
}
|
||||
Err(CaptureError::Cancelled(reason)) => {
|
||||
log::info!("Image operation cancelled: {reason}");
|
||||
*status.lock().await = CaptureStatus::Cancelled(reason.clone());
|
||||
CaptureOutcome::Cancelled { operation, reason }
|
||||
}
|
||||
Err(error) => {
|
||||
let message = operation.format_error(&error);
|
||||
log::error!("Image operation failed: {message}");
|
||||
*status.lock().await = CaptureStatus::Failed(message.clone());
|
||||
CaptureOutcome::Failed { operation, message }
|
||||
}
|
||||
}
|
||||
@@ -566,7 +550,6 @@ mod transport_tests {
|
||||
terminal_reported: false,
|
||||
shutdown_requested: Arc::new(AtomicBool::new(false)),
|
||||
worker: None,
|
||||
status: Arc::new(tokio::sync::Mutex::new(CaptureStatus::Idle)),
|
||||
};
|
||||
(manager, request_rx, completion_tx)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ pub use manager::{CaptureManager, CapturePoll, CaptureRequestId, CaptureSubmitEr
|
||||
pub(crate) use pipeline::CaptureRequest;
|
||||
#[allow(unused_imports)]
|
||||
pub use types::{
|
||||
CaptureDestination, CaptureError, CaptureOutcome, CaptureResult, CaptureStatus, CaptureType,
|
||||
CaptureDestination, CaptureError, CaptureOutcome, CaptureResult, CaptureType,
|
||||
DesktopBackdropCaptureRequest, DesktopBackdropCaptureResult, DesktopBackdropGeometry,
|
||||
DesktopBackdropOutputGeometry, DocumentDeliveryRequest, DocumentRenderJob,
|
||||
ImageDeliveryRequest, ImageFormatMetadata, ImageOperationKind, ImageRenderJob,
|
||||
|
||||
@@ -15,7 +15,7 @@ use crate::capture::{
|
||||
dependencies::{CaptureDependencies, CaptureFuture, CaptureSource},
|
||||
file::FileSaveConfig,
|
||||
manager::{CaptureManager, CapturePoll, CaptureSubmitError},
|
||||
types::{CaptureDestination, CaptureError, CaptureOutcome, CaptureStatus, CaptureType},
|
||||
types::{CaptureDestination, CaptureError, CaptureOutcome, CaptureType},
|
||||
};
|
||||
|
||||
use super::fixtures::{MockClipboard, MockSaver, MockSource, create_placeholder_image};
|
||||
@@ -84,13 +84,6 @@ fn rendered_pdf(bytes: Vec<u8>) -> RenderedDocument {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_capture_manager_creation() {
|
||||
let manager = CaptureManager::new(&tokio::runtime::Handle::current());
|
||||
let status = manager.get_status().await;
|
||||
assert_eq!(status, CaptureStatus::Idle);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn completion_is_observable_when_the_notifier_runs() {
|
||||
let deps = CaptureDependencies {
|
||||
@@ -304,7 +297,6 @@ async fn test_capture_manager_with_dependencies() {
|
||||
other => panic!("Expected success outcome, got {:?}", other),
|
||||
}
|
||||
assert_eq!(*clipboard_calls.lock().unwrap(), 1);
|
||||
assert_eq!(manager.get_status().await, CaptureStatus::Success);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -366,11 +358,6 @@ async fn capture_manager_records_failure_status() {
|
||||
}
|
||||
other => panic!("Expected failure outcome, got {other:?}"),
|
||||
}
|
||||
|
||||
assert!(matches!(
|
||||
manager.get_status().await,
|
||||
CaptureStatus::Failed(_)
|
||||
));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -410,10 +397,6 @@ async fn capture_manager_preserves_user_cancellation_as_a_terminal_outcome() {
|
||||
reason,
|
||||
}) if reason == "user dismissed portal"
|
||||
));
|
||||
assert!(matches!(
|
||||
manager.get_status().await,
|
||||
CaptureStatus::Cancelled(reason) if reason == "user dismissed portal"
|
||||
));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -526,7 +509,6 @@ async fn request_image_delivery_queues_manager_backed_path() {
|
||||
}
|
||||
assert_eq!(*saver_handle.calls.lock().unwrap(), 1);
|
||||
assert!(captured_types.lock().unwrap().is_empty());
|
||||
assert_eq!(manager.get_status().await, CaptureStatus::Success);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -576,7 +558,6 @@ async fn request_document_delivery_reports_board_pdf_success() {
|
||||
}
|
||||
assert_eq!(*saver_handle.calls.lock().unwrap(), 1);
|
||||
assert!(captured_types.lock().unwrap().is_empty());
|
||||
assert_eq!(manager.get_status().await, CaptureStatus::Success);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -632,12 +613,6 @@ async fn request_image_delivery_records_canvas_save_failure() {
|
||||
}
|
||||
assert_eq!(*saver_handle.calls.lock().unwrap(), 1);
|
||||
assert!(captured_types.lock().unwrap().is_empty());
|
||||
assert!(matches!(
|
||||
manager.get_status().await,
|
||||
CaptureStatus::Failed(ref message)
|
||||
if message.contains("Failed to save canvas export")
|
||||
&& !message.to_lowercase().contains("screenshot")
|
||||
));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -688,11 +663,6 @@ async fn request_document_delivery_records_board_pdf_save_failure() {
|
||||
}
|
||||
assert_eq!(*saver_handle.calls.lock().unwrap(), 1);
|
||||
assert!(captured_types.lock().unwrap().is_empty());
|
||||
assert!(matches!(
|
||||
manager.get_status().await,
|
||||
CaptureStatus::Failed(ref message)
|
||||
if message.contains("Failed to save board PDF export")
|
||||
));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -742,5 +712,4 @@ async fn request_image_delivery_preserves_clipboard_success_when_file_fails() {
|
||||
}
|
||||
assert_eq!(*clipboard_calls.lock().unwrap(), 1);
|
||||
assert!(captured_types.lock().unwrap().is_empty());
|
||||
assert_eq!(manager.get_status().await, CaptureStatus::Success);
|
||||
}
|
||||
@@ -507,21 +507,3 @@ impl From<std::io::Error> for CaptureError {
|
||||
Self::SaveError(value)
|
||||
}
|
||||
}
|
||||
|
||||
/// Status of an ongoing capture operation.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum CaptureStatus {
|
||||
/// Capture is idle/not started.
|
||||
Idle,
|
||||
/// Waiting for user permission from portal.
|
||||
AwaitingPermission,
|
||||
/// Capture is in progress.
|
||||
#[allow(dead_code)] // Will be used in Phase 2 for progress UI
|
||||
InProgress,
|
||||
/// Capture completed successfully.
|
||||
Success,
|
||||
/// Capture failed.
|
||||
Failed(String),
|
||||
/// Capture was cancelled by the user.
|
||||
Cancelled(String),
|
||||
}
|
||||
@@ -37,7 +37,7 @@ pub use render::{
|
||||
pub use shape::{
|
||||
ArrowLabel, BlurStyle, EmbeddedImage, EraserBrush, EraserKind, PolygonKind,
|
||||
REGULAR_POLYGON_DEFAULT_SIDES, REGULAR_POLYGON_MAX_SIDES, REGULAR_POLYGON_MIN_SIDES, Shape,
|
||||
StepMarkerLabel, clamp_regular_sides, invalidate_text_cache,
|
||||
StepMarkerLabel, clamp_regular_sides,
|
||||
};
|
||||
|
||||
// Re-export color constants for public API (unused internally but part of public interface)
|
||||
|
||||
@@ -12,7 +12,6 @@ pub use polygon::{
|
||||
PolygonKind, REGULAR_POLYGON_DEFAULT_SIDES, REGULAR_POLYGON_MAX_SIDES,
|
||||
REGULAR_POLYGON_MIN_SIDES, clamp_regular_sides,
|
||||
};
|
||||
pub use text_cache::invalidate_text_cache;
|
||||
pub use types::{
|
||||
ArrowLabel, BlurStyle, EmbeddedImage, EraserBrush, EraserKind, Shape, StepMarkerLabel,
|
||||
};
|
||||
|
||||
@@ -541,13 +541,6 @@ fn logical_bounds_in(layout: &pango::Layout) -> LogicalBounds {
|
||||
}
|
||||
}
|
||||
|
||||
/// Clear the text measurement cache.
|
||||
/// Call this when font configuration changes.
|
||||
#[allow(dead_code)]
|
||||
pub fn invalidate_text_cache() {
|
||||
TEXT_CACHE.with(|cache| cache.borrow_mut().clear());
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -131,7 +131,6 @@ pub fn daemon_pid_file() -> PathBuf {
|
||||
}
|
||||
|
||||
/// Location for persistent logs.
|
||||
#[allow(dead_code)]
|
||||
pub fn log_dir() -> PathBuf {
|
||||
data_dir()
|
||||
.unwrap_or_else(|| home_dir().unwrap_or_else(fallback_runtime_root))
|
||||
|
||||
@@ -77,7 +77,6 @@ impl LoadSnapshotOutcome {
|
||||
}
|
||||
|
||||
/// Attempt to load a previously saved session.
|
||||
#[allow(dead_code)]
|
||||
pub fn load_snapshot(options: &SessionOptions) -> Result<Option<SessionSnapshot>> {
|
||||
match load_snapshot_with_outcome(options)? {
|
||||
LoadSnapshotOutcome::Loaded(snapshot)
|
||||
|
||||
@@ -12,7 +12,6 @@ use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
#[allow(dead_code)]
|
||||
const AUTOSAVE_HISTORY_FALLBACK_DEPTH: usize = 1;
|
||||
|
||||
mod payload;
|
||||
@@ -41,7 +40,6 @@ pub use model::{
|
||||
};
|
||||
|
||||
/// Persist the provided snapshot to disk according to the configured options.
|
||||
#[allow(dead_code)]
|
||||
pub fn save_snapshot(snapshot: &SessionSnapshot, options: &SessionOptions) -> Result<()> {
|
||||
save_snapshot_with_report(snapshot, options).map(|_| ())
|
||||
}
|
||||
|
||||
@@ -159,24 +159,11 @@ pub fn draw_icon_board(ctx: &Context, x: f64, y: f64, size: f64) {
|
||||
let _ = ctx.stroke();
|
||||
}
|
||||
|
||||
/// Draw a drag-grip glyph: three horizontal bars, as on the toolbar move
|
||||
/// handles. Uses the context's current source color.
|
||||
#[allow(dead_code)] // referenced by the toolbar-gtk frontend only
|
||||
pub fn draw_icon_grip_bars(ctx: &Context, x: f64, y: f64, size: f64) {
|
||||
draw_icon_drag(ctx, x, y, size);
|
||||
}
|
||||
|
||||
/// Draw the toolbar drag handle.
|
||||
pub fn draw_icon_drag(ctx: &Context, x: f64, y: f64, size: f64) {
|
||||
super::svg::render_drag(ctx, x, y, size);
|
||||
}
|
||||
|
||||
/// Draw a minimize dash (not an X: the bar collapses to a restore tab).
|
||||
#[allow(dead_code)] // referenced by the toolbar-gtk frontend only
|
||||
pub fn draw_icon_dash(ctx: &Context, x: f64, y: f64, size: f64) {
|
||||
draw_icon_minimize(ctx, x, y, size);
|
||||
}
|
||||
|
||||
/// Draw `count` centered horizontal density bars, the layout-cycle glyph
|
||||
/// family's shared geometry. The stroke is thinner than the lone minus so
|
||||
/// the three-bar variant still reads at the 18px compact chrome size.
|
||||
@@ -211,29 +198,6 @@ pub fn draw_icon_layout_advanced(ctx: &Context, x: f64, y: f64, size: f64) {
|
||||
draw_layout_density_bars(ctx, x, y, size, 3);
|
||||
}
|
||||
|
||||
/// Draw a pushpin glyph ("keep open at startup"): outline when unpinned,
|
||||
/// filled when pinned. Geometry mirrors the built-in pin chrome button.
|
||||
#[allow(dead_code)] // referenced by the toolbar-gtk frontend only
|
||||
pub fn draw_icon_pushpin(ctx: &Context, x: f64, y: f64, size: f64, filled: bool) {
|
||||
if filled {
|
||||
draw_icon_pin(ctx, x, y, size);
|
||||
} else {
|
||||
draw_icon_unpin(ctx, x, y, size);
|
||||
}
|
||||
}
|
||||
|
||||
/// Outline pushpin with the 4-arg painter shape used by icon widgets.
|
||||
#[allow(dead_code)] // referenced by the toolbar-gtk frontend only
|
||||
pub fn draw_icon_pin_outline(ctx: &Context, x: f64, y: f64, size: f64) {
|
||||
draw_icon_unpin(ctx, x, y, size);
|
||||
}
|
||||
|
||||
/// Filled pushpin with the 4-arg painter shape used by icon widgets.
|
||||
#[allow(dead_code)] // referenced by the toolbar-gtk frontend only
|
||||
pub fn draw_icon_pin_filled(ctx: &Context, x: f64, y: f64, size: f64) {
|
||||
draw_icon_pin(ctx, x, y, size);
|
||||
}
|
||||
|
||||
pub fn draw_icon_pin(ctx: &Context, x: f64, y: f64, size: f64) {
|
||||
super::svg::render_pin(ctx, x, y, size);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ pub use help_overlay::HelpOverlayBindings;
|
||||
pub use help_overlay::install_help_hit_map_for_test;
|
||||
#[allow(unused_imports)]
|
||||
pub use help_overlay::{
|
||||
HelpOverlayRegion, clear_help_overlay_hit_map, help_overlay_region_at,
|
||||
invalidate_help_overlay_cache, render_help_overlay,
|
||||
HelpOverlayRegion, clear_help_overlay_hit_map, help_overlay_region_at, render_help_overlay,
|
||||
};
|
||||
pub use input_hud::{input_hud_geometry, render_input_hud};
|
||||
pub use onboarding_card::{OnboardingCard, OnboardingChecklistItem, render_onboarding_card};
|
||||
|
||||
@@ -11,7 +11,6 @@ mod types;
|
||||
#[cfg(test)]
|
||||
pub use render::install_help_hit_map_for_test;
|
||||
pub use render::{
|
||||
HelpOverlayRegion, clear_help_overlay_hit_map, help_overlay_region_at,
|
||||
invalidate_help_overlay_cache, render_help_overlay,
|
||||
HelpOverlayRegion, clear_help_overlay_hit_map, help_overlay_region_at, render_help_overlay,
|
||||
};
|
||||
pub use sections::HelpOverlayBindings;
|
||||
@@ -148,12 +148,3 @@ pub(super) fn get_or_build_overlay_layout(
|
||||
layout
|
||||
})
|
||||
}
|
||||
|
||||
/// Invalidate the help overlay layout cache.
|
||||
/// Call this when style settings change.
|
||||
#[allow(dead_code)]
|
||||
pub fn invalidate_help_overlay_cache() {
|
||||
LAYOUT_CACHE.with(|cache| {
|
||||
*cache.borrow_mut() = None;
|
||||
});
|
||||
}
|
||||
@@ -20,7 +20,6 @@ use cache::get_or_build_overlay_layout;
|
||||
use frame::draw_overlay_frame;
|
||||
use header::{HeaderContent, HeaderHint, draw_hints, draw_version_pill};
|
||||
|
||||
pub use cache::invalidate_help_overlay_cache;
|
||||
#[cfg(test)]
|
||||
pub use hit::install_help_hit_map_for_test;
|
||||
pub use hit::{HelpOverlayRegion, clear_help_overlay_hit_map, help_overlay_region_at};
|
||||
|
||||