quality pass 2: cached encoders, cancel in gif retry, overlay CSS split
- debug logging in picker changed to tracing::debug - show_overlay uses visible_window_bounds helper - encode_gif retry loop checks cancel flag between attempts - list_encoders cached via OnceLock (ffmpeg -encoders runs once) - remove unnecessary GifBudgetMode clone (is Copy) - config test uses unique temp dir per process - click highlights use 2px border instead of solid fill - audio capture_loop polls at 5ms instead of 1ms - overlay window loads minimal overlay.css instead of full app.css - remove non-spec 960x540 preset - Settings dirty detection uses field-by-field comparison - Overlay startDragging catches errors - pauseRec only emits recording-state on success - Picker listener cleanup guards against unmount race - add sync notes for previewDims and sr-only trim inputs
This commit is contained in:
+11
-18
@@ -386,7 +386,7 @@ fn start_capture(
|
||||
|
||||
let session = capture::start(
|
||||
output,
|
||||
ffmpeg.clone(),
|
||||
ffmpeg,
|
||||
cfg.capture.capture_cursor,
|
||||
cfg.capture.capture_audio,
|
||||
crop,
|
||||
@@ -848,30 +848,23 @@ fn show_overlay(app: AppHandle) -> Result<(), String> {
|
||||
let _ = mark_overlay_excluded_from_capture(&win);
|
||||
|
||||
// If the overlay is off-screen (monitor disconnected), center on primary
|
||||
use windows::Win32::Foundation::{HWND, POINT, RECT};
|
||||
use windows::Win32::Foundation::{HWND, POINT};
|
||||
use windows::Win32::Graphics::Gdi::{
|
||||
GetMonitorInfoW, MonitorFromPoint, MONITOR_DEFAULTTOPRIMARY, MONITOR_DEFAULTTONULL, MONITORINFO,
|
||||
};
|
||||
use windows::Win32::UI::WindowsAndMessaging::{GetWindowRect, SetWindowPos, HWND_TOP, SWP_NOACTIVATE, SWP_NOSIZE, SWP_NOZORDER};
|
||||
use windows::Win32::UI::WindowsAndMessaging::{SetWindowPos, HWND_TOP, SWP_NOACTIVATE, SWP_NOSIZE, SWP_NOZORDER};
|
||||
if let Ok(raw) = win.hwnd() {
|
||||
let hwnd = HWND(raw.0 as *mut _);
|
||||
let mut rect = RECT::default();
|
||||
if unsafe { GetWindowRect(hwnd, &mut rect) }.is_ok() {
|
||||
let center = POINT {
|
||||
x: (rect.left + rect.right) / 2,
|
||||
y: (rect.top + rect.bottom) / 2,
|
||||
};
|
||||
if let Some((vl, vt, vr, vb)) = visible_window_bounds(raw.0 as isize) {
|
||||
let center = POINT { x: (vl + vr) / 2, y: (vt + vb) / 2 };
|
||||
let hmon = unsafe { MonitorFromPoint(center, MONITOR_DEFAULTTONULL) };
|
||||
if hmon.0.is_null() {
|
||||
let hwnd = HWND(raw.0 as *mut _);
|
||||
let primary = unsafe { MonitorFromPoint(POINT { x: 0, y: 0 }, MONITOR_DEFAULTTOPRIMARY) };
|
||||
let mut mi = MONITORINFO {
|
||||
cbSize: std::mem::size_of::<MONITORINFO>() as u32,
|
||||
..Default::default()
|
||||
};
|
||||
let mut mi = MONITORINFO { cbSize: std::mem::size_of::<MONITORINFO>() as u32, ..Default::default() };
|
||||
if unsafe { GetMonitorInfoW(primary, &mut mi) }.as_bool() {
|
||||
let work = mi.rcWork;
|
||||
let w = rect.right - rect.left;
|
||||
let h = rect.bottom - rect.top;
|
||||
let w = vr - vl;
|
||||
let h = vb - vt;
|
||||
let cx = (work.left + work.right) / 2 - w / 2;
|
||||
let cy = (work.top + work.bottom) / 2 - h / 2;
|
||||
let _ = unsafe { SetWindowPos(hwnd, Some(HWND_TOP), cx, cy, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE) };
|
||||
@@ -992,7 +985,7 @@ fn open_window_picker(
|
||||
}
|
||||
}
|
||||
}
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"open_window_picker: monitor={}x{} exclude={:?}",
|
||||
mw,
|
||||
mh,
|
||||
@@ -1028,7 +1021,7 @@ fn open_window_picker(
|
||||
std::mem::size_of::<RECT>() as u32,
|
||||
)
|
||||
};
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"picker window: GetWindowRect=({},{},{},{}) DwmBounds=({},{},{},{})",
|
||||
gr.left, gr.top, gr.right, gr.bottom,
|
||||
dr.left, dr.top, dr.right, dr.bottom
|
||||
|
||||
Reference in New Issue
Block a user