Files
alkane-toolkit/thirdparty/wx-rs/patches/0001-linux-build-path.patch
T
noahandClaude Opus 4.8 bd17a33ea1 GUI round 2: selection, scan loop, column management, dark-mode fix
- Fixed "Scan ranges" button label (no longer grows with the range list).
- Dark-mode KPI cards: derive colours from the live system theme luminance
  instead of is_dark(), which mis-detected some GTK dark themes.
- Removed the checkbox column; the table is multi-select (wxDV_MULTIPLE,
  ctrl/shift-click), with the selection tracked by IP so it survives refreshes.
- Replaced Rescan with Play / Pause / Stop; added an editable auto-rescan
  interval (scan-ranges dialog; ~/.config/alkane-toolkit/auto-rescan-secs.txt)
  with a timer-driven countdown scheduler.
- Status bar shows the last-probed IP during a scan and a countdown to the next
  scan when idle (dropped the "scan complete" text).
- Default sort is IP-ascending with a header chevron; IP is column 0, sortable.
- Choose-columns dialog is a wxRearrangeCtrl (check to show; up/down or drag to
  reorder) exposing every metric, including Pool 1/2/3 URL + worker.
- Column drag-reorder moves the whole column with its data on drop.
- Row separator lines (wxDV_ROW_LINES). GTK3 native has no zebra striping; a
  GTK4-forward zebra-CSS hook and pkg-config gtk cflags are in place.

Scan engine: parse each configured pool's (url, worker); Progress carries the
last-probed IP. Model: Column::Sel removed; Pool1/2/3 columns; default IP sort.

wx-rs bridge: multi-select + selection/context-menu events + get_selections,
alternating-row + zebra-CSS hooks, in-place column title, rearrangeable list,
and popup-menu primitives (for the upcoming right-click config menu). Patches
0001-0003 regenerated and round-trip validated.

Review fixes: scan loop no longer sticks "scanning" if a thread ends without
Done (channel-disconnect handling + Stop force-reset); Play no longer starts a
second scan; stale selections pruned on rescan; column apply order/visibility
applied atomically.

Verified: 22 unit tests, a 14-check headless UI self-test, and interaction
checks (multi-select, column rearrange/drag, play/pause/stop, dark mode).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-16 17:27:20 -06:00

114 lines
3.9 KiB
Diff

--- a/build.rs
+++ b/build.rs
@@ -24,8 +24,14 @@
cfg!(target_os = "macos")
}
+// alkane-toolkit patch: real wxGTK3 support on Linux via wx-config
+// (upstream stubbed every non-Windows/macOS target).
+fn is_linux() -> bool {
+ cfg!(target_os = "linux")
+}
+
fn is_stub() -> bool {
- cfg!(feature = "stub_lib") || (!is_windows() && !is_osx())
+ cfg!(feature = "stub_lib") || (!is_windows() && !is_osx() && !is_linux())
}
fn main() -> Result<(), Box<dyn Error>> {
@@ -35,6 +41,9 @@
if is_stub() {
return Ok(());
}
+ if is_linux() {
+ return Ok(()); // libs are linked inside build_linux()
+ }
let wx_libs = get_libs(&wx_path)?;
@@ -80,7 +89,7 @@
fn download_dist() -> Result<PathBuf, Box<dyn Error>> {
let dist_path = Path::new("./dist/");
let wx_path = PathBuf::from(format!("./dist/{}", WX_PATH));
- if wx_path.exists() || is_stub() {
+ if wx_path.exists() || is_stub() || is_linux() {
return Ok(wx_path);
}
println!("cargo:warning=wx-rs: Downloading source to './dist/");
@@ -107,8 +116,14 @@
return Ok(());
}
println!("cargo:rerun-if-changed=cpp_src/wxbridge.cpp");
+ println!("cargo:rerun-if-changed=cpp_src/widgets_bridge.cpp");
+
+ // alkane-toolkit patch: compile the bridge (upstream + widgets extension)
+ // against the wx shown by $WX_RS_WXCONFIG (default `wx-config`).
+ if is_linux() {
+ return build_linux();
+ }
- //panic!("{}", wx_path.to_str().unwrap());
if is_windows() {
build_msvc(wx_path)?;
} else {
@@ -217,6 +232,59 @@
)?)
}
+fn build_linux() -> Result<(), Box<dyn Error>> {
+ // alkane-toolkit patch: GTK3 build driven entirely by wx-config, so the
+ // same code builds against our vendored static wx 3.3.3 (WX_RS_WXCONFIG
+ // pointing at its prefix) or any system wxGTK3.
+ let wxconfig = env::var("WX_RS_WXCONFIG").unwrap_or_else(|_| String::from("wx-config"));
+ let cxxflags = String::from_utf8(
+ Command::new(&wxconfig).arg("--cxxflags").output()?.stdout,
+ )?;
+ let libs = String::from_utf8(Command::new(&wxconfig).arg("--libs").output()?.stdout)?;
+ // The widget bridge uses GTK directly (zebra-striping CSS), so add GTK's own
+ // include paths. Best-effort: if pkg-config or gtk3-dev is missing the flags
+ // are simply empty and the GTK-only code stays disabled.
+ let gtk_cflags = Command::new("pkg-config")
+ .args(["--cflags", "gtk+-3.0"])
+ .output()
+ .ok()
+ .filter(|o| o.status.success())
+ .and_then(|o| String::from_utf8(o.stdout).ok())
+ .unwrap_or_default();
+
+ let mut build = cc::Build::new();
+ build.cpp(true)
+ .file("cpp_src/wxbridge.cpp")
+ .file("cpp_src/widgets_bridge.cpp");
+ for f in cxxflags.split_whitespace() {
+ build.flag(f);
+ }
+ for f in gtk_cflags.split_whitespace() {
+ build.flag(f);
+ }
+ build.compile("wxbridge");
+
+ for flag in libs.split_whitespace() {
+ if flag.starts_with('/') && flag.ends_with(".a") {
+ // static wx builds: wx-config emits the archive as a full path
+ let file = flag.rsplit('/').next().unwrap_or(flag);
+ let stem = file
+ .strip_prefix("lib")
+ .unwrap_or(file)
+ .strip_suffix(".a")
+ .unwrap_or(file);
+ println!("cargo:rustc-link-lib=static={}", stem);
+ } else if let Some(lib) = flag.strip_prefix("-l") {
+ println!("cargo:rustc-link-lib={}", lib);
+ } else if let Some(path) = flag.strip_prefix("-L") {
+ println!("cargo:rustc-link-search=native={}", path);
+ } else if flag == "-pthread" {
+ println!("cargo:rustc-link-arg=-pthread");
+ }
+ }
+ Ok(())
+}
+
fn embed_resource_file(wx_path: &PathBuf) {
/*
This was cribbed from https://github.com/nabijaczleweli/rust-embed-resource