Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src-tauri/src/consent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ static GRANTED_WINDOW_NAMES: AtomicBool = AtomicBool::new(false);

/// Whether the character should use this grant. The OS grant can remain after
/// the user unchecks; Dock geometry and titles must still follow this.
#[cfg_attr(target_os = "linux", allow(dead_code))] // #886
pub fn wanted(id: CapabilityId) -> bool {
match id {
#[cfg(not(target_os = "linux"))]
Expand Down Expand Up @@ -1204,13 +1203,6 @@ mod tests {
assert!(probe.granted(CapabilityId::WindowNames));
}

#[test]
#[cfg(target_os = "windows")]
fn windows_window_titles_prompt_is_noop() {
let probe = WindowsProbe;
probe.prompt(CapabilityId::WindowNames);
}

#[test]
#[cfg(target_os = "windows")]
fn windows_usable_follows_wanted() {
Expand Down
10 changes: 0 additions & 10 deletions src-tauri/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3814,16 +3814,6 @@ pub(crate) mod tests {
});
}

/// Blank Model API is one number, remote or local. A Harness turn is
/// `harness::TURN_TIMEOUT`, not this.
#[test]
fn a_model_api_turn_is_one_timeout_when_unset() {
with_env(None, None, None, || {
crate::dev_flags::seed(&crate::settings::Settings::default());
assert_eq!(timeout_for(), TIMEOUT);
});
}

/// One guard for every wake and every host. Nothing about the surface
/// the reply lands on, or about where the server runs, moves this number.
/// `THINK_CEILING` and a pinned cap are the only two things that do, and
Expand Down
31 changes: 0 additions & 31 deletions src-tauri/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,30 +560,6 @@ pub fn update_input_region(
)
}

/// Read and reset X11 mask rebuild counters. Returns (count, total_ns).
///
/// Reserved counters; measurement is via TRACE log. The bench script parses
/// that log and does not call this.
#[allow(dead_code)]
#[cfg(all(unix, not(target_os = "macos")))]
pub fn read_mask_rebuild_stats() -> (u64, u64) {
x11::read_mask_rebuild_stats()
}

/// Windows mask rebuild stats (SetWindowRgn). Same instrumentation as X11.
#[allow(dead_code)]
#[cfg(not(unix))]
pub fn read_mask_rebuild_stats() -> (u64, u64) {
windows::read_mask_rebuild_stats()
}

/// macOS uses set_ignore_cursor_events and is not instrumented yet.
#[allow(dead_code)]
#[cfg(target_os = "macos")]
pub fn read_mask_rebuild_stats() -> (u64, u64) {
(0, 0)
}

/// Windows: SetWindowRgn from the sprite's alpha mask for click-through.
#[cfg(not(unix))]
pub fn update_input_region(
Expand Down Expand Up @@ -1526,11 +1502,4 @@ mod tests {
"list_window_titles should return titles when wanted (may be empty in test env)"
);
}

#[test]
fn mask_rebuild_stats_returns_valid_tuple() {
let (count, ns) = read_mask_rebuild_stats();
// Just verify the function is callable and returns a tuple
let _ = (count, ns);
}
}
2 changes: 1 addition & 1 deletion src-tauri/src/platform/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mod settings_raise;
mod window_source;

pub(super) use console::{restore_ctrl_c, suppress_ctrl_c_for_children};
pub use overlay::{configure_overlay, read_mask_rebuild_stats, update_input_region};
pub use overlay::{configure_overlay, update_input_region};
pub use pointer::{buttons_down, double_click_interval_ms};
pub use sensing::WindowsActivitySource;
pub(super) use settings_raise::raise_settings_window;
Expand Down
33 changes: 0 additions & 33 deletions src-tauri/src/platform/windows/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//! outside the art still receives clicks. WDA_EXCLUDEFROMCAPTURE applies only
//! when the capturable setting, on by default (ADR-0024), is turned off.

use std::sync::atomic::{AtomicU64, Ordering};
use std::time::Instant;

use raw_window_handle::{HasWindowHandle, RawWindowHandle};
Expand All @@ -19,20 +18,6 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
WS_EX_LAYERED, WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, WS_EX_TOPMOST, WS_EX_TRANSPARENT,
};

static MASK_REBUILD_COUNT: AtomicU64 = AtomicU64::new(0);
static MASK_REBUILD_TOTAL_NS: AtomicU64 = AtomicU64::new(0);

/// Read and reset mask rebuild metrics. Returns (count, total_ns).
///
/// Reserved counters; measurement is via TRACE log
/// (`FIDGET_TRACE_MASK_REBUILD`).
#[allow(dead_code)]
pub fn read_mask_rebuild_stats() -> (u64, u64) {
let count = MASK_REBUILD_COUNT.swap(0, Ordering::Relaxed);
let total_ns = MASK_REBUILD_TOTAL_NS.swap(0, Ordering::Relaxed);
(count, total_ns)
}

/// Float above other windows, non-activating. Capturable unless Presence or
/// `FIDGET_CAPTURABLE=0` excludes it from shares.
/// Returns Err when the handle is not realized yet, so the caller can retry.
Expand Down Expand Up @@ -304,8 +289,6 @@ fn apply_input_mask(
}

let rebuild_ns = rebuild_start.elapsed().as_nanos() as u64;
MASK_REBUILD_COUNT.fetch_add(1, Ordering::Relaxed);
MASK_REBUILD_TOTAL_NS.fetch_add(rebuild_ns, Ordering::Relaxed);

if std::env::var("FIDGET_TRACE_MASK_REBUILD").is_ok() {
let rebuild_ms = rebuild_ns as f64 / 1_000_000.0;
Expand Down Expand Up @@ -333,19 +316,3 @@ fn clear_input_region(hwnd: HWND) -> Result<(), String> {

Ok(())
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn mask_rebuild_stats_readable_and_reset() {
let (count1, ns1) = read_mask_rebuild_stats();
assert_eq!(count1, 0, "stats should start at zero");
assert_eq!(ns1, 0);

let (count2, ns2) = read_mask_rebuild_stats();
assert_eq!(count2, 0, "stats should be zero after reset");
assert_eq!(ns2, 0);
}
}
2 changes: 1 addition & 1 deletion src-tauri/src/platform/x11/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod settings_raise;
mod window_source;

pub use input_events::{spawn_listener, InputEvent};
pub use overlay::{configure_overlay, read_mask_rebuild_stats, update_input_region};
pub use overlay::{configure_overlay, update_input_region};
pub use pointer::{buttons_down, double_click_interval_ms};
pub use sensing::X11ActivitySource;

Expand Down
34 changes: 0 additions & 34 deletions src-tauri/src/platform/x11/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
//! `wl_surface`, which nothing here matches; the input region is core Wayland
//! and unwired. DESIGN.md decision 3.

use std::sync::atomic::{AtomicU64, Ordering};
use std::time::Instant;

use x11rb::connection::Connection;
Expand All @@ -19,21 +18,6 @@ use x11rb::rust_connection::RustConnection;

use raw_window_handle::{HasWindowHandle, RawWindowHandle};

static MASK_REBUILD_COUNT: AtomicU64 = AtomicU64::new(0);
static MASK_REBUILD_TOTAL_NS: AtomicU64 = AtomicU64::new(0);

/// Read and reset mask rebuild metrics. Returns (count, total_ns).
///
/// Reserved counters; measurement is via TRACE log
/// (`FIDGET_TRACE_MASK_REBUILD`). The bench script parses that log and
/// does not call this.
#[allow(dead_code)]
pub fn read_mask_rebuild_stats() -> (u64, u64) {
let count = MASK_REBUILD_COUNT.swap(0, Ordering::Relaxed);
let total_ns = MASK_REBUILD_TOTAL_NS.swap(0, Ordering::Relaxed);
(count, total_ns)
}

/// Float above other windows, non-activating, skip the taskbar and pager.
/// Returns Err when the handle is not realized yet, so the caller can retry.
pub fn configure_overlay(window: &tauri::WebviewWindow) -> Result<(), String> {
Expand Down Expand Up @@ -246,8 +230,6 @@ fn apply_input_mask(
.map_err(|e| format!("Failed to flush X11: {e}"))?;

let rebuild_elapsed = rebuild_start.elapsed().as_nanos() as u64;
MASK_REBUILD_COUNT.fetch_add(1, Ordering::Relaxed);
MASK_REBUILD_TOTAL_NS.fetch_add(rebuild_elapsed, Ordering::Relaxed);

if std::env::var("FIDGET_TRACE_MASK_REBUILD").is_ok() {
let opaque_count = opaque.iter().filter(|&&b| b).count();
Expand Down Expand Up @@ -303,19 +285,3 @@ fn set_ewmh_states(conn: &RustConnection, window: u32) -> Result<(), String> {
.map_err(|e| format!("Failed to flush X11: {e}"))?;
Ok(())
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn mask_rebuild_stats_readable_and_reset() {
let (count1, ns1) = read_mask_rebuild_stats();
assert_eq!(count1, 0, "stats should start at zero");
assert_eq!(ns1, 0);

let (count2, ns2) = read_mask_rebuild_stats();
assert_eq!(count2, 0, "stats should be zero after reset");
assert_eq!(ns2, 0);
}
}
Loading