Port the toolkit GUI to Windows (wxMSW, cross-built with mingw-w64)
Build: the wx-rs build script chose the platform with cfg!(), which in a build script describes the build host, so a Linux-to-Windows build took the GTK path. It now reads CARGO_CFG_TARGET_*, and Windows/GNU builds through wx-config exactly like GTK, against a static wxMSW from scripts/build-wx-windows.sh. The C++ runtime is linked statically, so the .exe imports only Windows system DLLs. crates/alkane-gui/build.rs embeds an application manifest (Common Controls v6, per-monitor DPI v2, UTF-8 code page, Windows 10/11), the icon and version info. Bridge on wxMSW (patches 0007/0008): - the upstream frame's invisible "OSX key events" child sat above the UI on MSW and swallowed every click and key; it is no longer created there - light/dark is chosen before the first window (wxMSW ignores it later) and follows the Windows app mode, with dark grid rules for the data view - the generic wxDataViewCtrl gets mouse input in its inner main window, so drag-select and the per-cell / per-icon tooltips bind there (GTK keeps its native GtkTreeView paths; the icon hit-test is shared) - sizes cross the Rust/C++ boundary in DIPs (identity on GTK), so columns, icons, KPI cards and the status bar scale at 125-200 % - vector shapes go through GDI+ (anti-aliased like Cairo on GTK); selected rows use the themed list-view text colour like the native renderer - the frame never opens larger than the monitor work area; title-bar icon from the executable; upstream menu insert no longer reads UTF-8 as UTF-16 App: OS differences live in alkane_core::platform (settings in %APPDATA%\alkane-toolkit, owner-only secret files, NUL, console-less helper processes). SSH password logins use SSH_ASKPASS with the toolkit itself as the helper on every platform, replacing sshpass, which Windows lacks. Release builds are GUI-subsystem; headless modes attach to the parent console. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,7 +40,6 @@ pub enum ScanMsg {
|
||||
Failed(String),
|
||||
}
|
||||
|
||||
pub const CONFIG_DIR: &str = ".config/alkane-toolkit";
|
||||
pub const RANGES_FILE: &str = "scan-ranges.txt";
|
||||
pub const AUTO_FILE: &str = "auto-rescan-secs.txt";
|
||||
pub const SCAN_TIMEOUT_FILE: &str = "scan-timeout-secs.txt";
|
||||
@@ -128,9 +127,10 @@ pub fn save_scan_timeout(secs: u64) -> std::io::Result<()> {
|
||||
std::fs::write(p, secs.max(1).to_string())
|
||||
}
|
||||
|
||||
/// `file` inside the per-user settings directory (`~/.config/alkane-toolkit`,
|
||||
/// or `%APPDATA%\alkane-toolkit` on Windows; see `alkane_core::platform`).
|
||||
pub fn config_path(file: &str) -> PathBuf {
|
||||
let home = std::env::var("HOME").unwrap_or_else(|_| ".".into());
|
||||
PathBuf::from(home).join(CONFIG_DIR).join(file)
|
||||
alkane_core::platform::config_path(file)
|
||||
}
|
||||
|
||||
pub fn load_ranges() -> Vec<String> {
|
||||
@@ -2368,17 +2368,18 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn auto_secs_round_trip_and_defaults() {
|
||||
// config_path() reads $HOME; point it at a private temp dir. HOME is
|
||||
// process-global, so serialise against other HOME-mutating tests and
|
||||
// restore HOME afterward (round 18 #12).
|
||||
// config_path() reads the platform's config root ($HOME, or %APPDATA%
|
||||
// on Windows); point it at a private temp dir. It is process-global, so
|
||||
// serialise against other such tests and restore it afterward (round 18 #12).
|
||||
let _home = crate::model::HOME_TEST_LOCK
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner());
|
||||
let prev = std::env::var_os("HOME");
|
||||
let root_var = alkane_core::platform::CONFIG_ROOT_VAR;
|
||||
let prev = std::env::var_os(root_var);
|
||||
let dir = std::env::temp_dir().join(format!("alkane-test-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
std::env::set_var("HOME", &dir);
|
||||
std::env::set_var(root_var, &dir);
|
||||
|
||||
assert_eq!(
|
||||
load_auto_secs(),
|
||||
@@ -2393,8 +2394,8 @@ mod tests {
|
||||
assert_eq!(load_auto_secs(), 42, "whitespace tolerated");
|
||||
|
||||
match prev {
|
||||
Some(v) => std::env::set_var("HOME", v),
|
||||
None => std::env::remove_var("HOME"),
|
||||
Some(v) => std::env::set_var(root_var, v),
|
||||
None => std::env::remove_var(root_var),
|
||||
}
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user