mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-24 22:09:14 +00:00
fix(windows): warn when launched on a hidden window station
The invisible Capacity Dock was not a rendering bug. The debug exe had been
started through the QEMU guest agent's guest-exec, which runs as a service in
session 0, so the dock window was created on a window station that no desktop
shows. The stderr trace ("window created and shown") was accurate; the window
was simply never visible. Launched from the interactive session, the same
binary docks the rail at the right edge, shows the quiet "--" row without
providers, expands on hover, closes on toggle off and comes back on toggle on.
Debug builds on Windows now check the process window station for WSF_VISIBLE
at startup and print a warning when it is missing, so the next service session
launch explains itself. Verified: fires under a SYSTEM scheduled task, silent
from a terminal. Only a feature flag is added to the existing windows-sys
dependency; no versions change.
This commit is contained in:
parent
c535a97873
commit
004d736f8d
2 changed files with 38 additions and 1 deletions
|
|
@ -28,7 +28,7 @@ reqwest = { version = "0.12", default-features = false, features = ["json", "rus
|
|||
fontdue = "0.9"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
windows-sys = { version = "0.59", features = ["Win32_Foundation", "Win32_Graphics_Dwm", "Win32_UI_WindowsAndMessaging"] }
|
||||
windows-sys = { version = "0.59", features = ["Win32_Foundation", "Win32_Graphics_Dwm", "Win32_System_StationsAndDesktops", "Win32_UI_WindowsAndMessaging"] }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
ksni = "0.3"
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ pub fn run() {
|
|||
plan: plan::PlanClient::new(),
|
||||
});
|
||||
|
||||
#[cfg(all(debug_assertions, target_os = "windows"))]
|
||||
warn_if_window_station_hidden();
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
build_tray_tauri(app.handle())?;
|
||||
|
||||
|
|
@ -281,6 +284,40 @@ fn parse_click(payload: &str) -> Option<(i32, i32)> {
|
|||
Some((x, y))
|
||||
}
|
||||
|
||||
/// A process started from a service session (the QEMU guest agent's guest-exec, SSH, a
|
||||
/// scheduled task) gets a window station nobody is looking at: the tray icon and every window,
|
||||
/// dock included, report success and never reach the desktop. That exact trace cost a full
|
||||
/// debugging round on the VM, so debug builds now say so on startup.
|
||||
#[cfg(all(debug_assertions, target_os = "windows"))]
|
||||
fn warn_if_window_station_hidden() {
|
||||
use windows_sys::Win32::System::StationsAndDesktops::{
|
||||
GetProcessWindowStation, GetUserObjectInformationW, UOI_FLAGS, USEROBJECTFLAGS,
|
||||
};
|
||||
const WSF_VISIBLE: u32 = 0x0001;
|
||||
|
||||
let mut flags = USEROBJECTFLAGS {
|
||||
fInherit: 0,
|
||||
fReserved: 0,
|
||||
dwFlags: 0,
|
||||
};
|
||||
let mut needed = 0u32;
|
||||
let ok = unsafe {
|
||||
GetUserObjectInformationW(
|
||||
GetProcessWindowStation(),
|
||||
UOI_FLAGS,
|
||||
&mut flags as *mut USEROBJECTFLAGS as *mut std::ffi::c_void,
|
||||
std::mem::size_of::<USEROBJECTFLAGS>() as u32,
|
||||
&mut needed,
|
||||
)
|
||||
};
|
||||
if ok != 0 && flags.dwFlags & WSF_VISIBLE == 0 {
|
||||
eprintln!(
|
||||
"codeburn: running on a non-interactive window station (service session launch); \
|
||||
the tray icon and windows will never appear on the desktop"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Undecorated windows are square by default; ask DWM for the Windows 11 rounded corner so
|
||||
/// the acrylic backdrop is clipped to the same shape as the popover card. Silently ignored
|
||||
/// on Windows 10, where the corners stay square.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue