Delete the standalone xframe-layout crate
The unified XFrame-native canvas lives inside the designer now, so the standalone layout process, its file-based selection IPC and its workspace membership are gone. The Flatpak launcher just starts the designer; xframe-common no longer mentions the layout in its description and activate_window is documented for its remaining use.
This commit is contained in:
1 parent
5490802120
commit
fea9ea368f
9 files changed
+9
-1320
No files matched your search
Generated
-10
@@ -910,16 +910,6 @@ dependencies = [
|
||||
name = "xframe-indicators"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "xframe-layout"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"x11rb",
|
||||
"xframe-common",
|
||||
"xframe-core",
|
||||
"xframe-widgets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xframe-palette"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -8,7 +8,6 @@ members = [
|
||||
"crates/xframe-common",
|
||||
"crates/xframe-demo",
|
||||
"crates/xframe-palette",
|
||||
"crates/xframe-layout",
|
||||
"crates/xframe-test-runner",
|
||||
"crates/xframe-core",
|
||||
"crates/xframe-indicators",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name = "xframe-common"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Shared X11/registry/stub-widget support for the LightGUI Rust port (xframe-demo, xframe-palette, xframe-layout, xframe-test-runner). Port of widgets/common/{registry,ico,ipc}.h and the widgets/core style manager (lightgui eb0b5fc)."
|
||||
description = "Shared X11/registry/stub-widget support for the LightGUI Rust port (xframe-demo, xframe-palette, xframe-test-runner). Port of widgets/common/{registry,ico,ipc}.h and the widgets/core style manager (lightgui eb0b5fc)."
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -283,10 +283,9 @@ impl X11 {
|
||||
/// Bring a window to the front and give it keyboard focus, the
|
||||
/// EWMH way: restack above its siblings, ask the WM to activate
|
||||
/// it (`_NET_ACTIVE_WINDOW`, source = application), and set the
|
||||
/// input focus. Used by xframe-layout when a new palette
|
||||
/// selection arrives: without this the layout window stays buried
|
||||
/// behind the designer and the user's placement click lands on
|
||||
/// the designer's canvas instead.
|
||||
/// input focus. Kept as a utility for windows that must come to
|
||||
/// the front on demand (the standalone layout that used it is
|
||||
/// deleted; the canvas lives inside the designer now).
|
||||
pub fn activate_window(&self, win: Window) -> Result<(), Box<dyn std::error::Error>> {
|
||||
self.conn
|
||||
.configure_window(win, &ConfigureWindowAux::new().stack_mode(StackMode::ABOVE))?;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
[package]
|
||||
name = "xframe-layout"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "LightGUI layout/design window on x11rb: place/move/resize/delete widgets, resize handles, script mode. Port of widgets/layout/main_layout.cpp (lightgui eb0b5fc)."
|
||||
license = "MIT"
|
||||
|
||||
[[bin]]
|
||||
name = "xframe-layout"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
xframe-common = { path = "../xframe-common" }
|
||||
xframe-core = { path = "../xframe-core" }
|
||||
xframe-widgets = { path = "../xframe-widgets" }
|
||||
x11rb = "0.13"
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,113 +0,0 @@
|
||||
//! Layout script-mode test under Xvfb on display :92 (kept clear of
|
||||
//! the demo :98, palette :93 and runner :91 tests). Exercises the
|
||||
//! full script command set, including PLACE_ALL (547 stubs) and the
|
||||
//! GtkInvisible BLANK-EXPECTED CHECKDRAW path.
|
||||
use std::path::PathBuf;
|
||||
use std::process::{Child, Command, Stdio};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
fn layout_bin() -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_BIN_EXE_xframe-layout"))
|
||||
}
|
||||
|
||||
fn start_xvfb(display: &str) -> Option<Child> {
|
||||
// A SIGKILLed Xvfb leaves its socket behind; a stale socket makes
|
||||
// the wait below return at once and the X client then fails to
|
||||
// connect. Remove it when no server for this display is alive.
|
||||
let sock_path = format!("/tmp/.X11-unix/X{}", display.trim_start_matches(':'));
|
||||
let server_running = Command::new("pgrep")
|
||||
.args(["-f", &format!("Xvfb {}", display)])
|
||||
.output()
|
||||
.map(|o| o.status.success())
|
||||
.unwrap_or(false);
|
||||
if !server_running && PathBuf::from(&sock_path).exists() {
|
||||
let _ = std::fs::remove_file(&sock_path);
|
||||
}
|
||||
let child = Command::new("Xvfb")
|
||||
.args([display, "-screen", "0", "1280x1024x24"])
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.spawn()
|
||||
.ok()?;
|
||||
let sock = format!("/tmp/.X11-unix/X{}", display.trim_start_matches(':'));
|
||||
let t0 = Instant::now();
|
||||
while !PathBuf::from(&sock).exists() {
|
||||
if t0.elapsed() > Duration::from_secs(10) {
|
||||
return None;
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
}
|
||||
Some(child)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn layout_script_full_command_set() {
|
||||
let mut xvfb = match start_xvfb(":92") {
|
||||
Some(c) => c,
|
||||
None => {
|
||||
eprintln!("Xvfb unavailable; skipping X test");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let dir = std::env::temp_dir().join("xframe-layout-test");
|
||||
let _ = std::fs::create_dir_all(&dir);
|
||||
let script = dir.join("cmds.txt");
|
||||
let log = dir.join("out.log");
|
||||
let saved = dir.join("saved.txt");
|
||||
let state = dir.join("layout-state.txt");
|
||||
let _ = std::fs::remove_file(&log);
|
||||
std::fs::write(
|
||||
&script,
|
||||
format!(
|
||||
"# layout script test\nPLACE GtkButton 40 40 340 200\nPLACE GtkInvisible 11 11 10 10\nCHECKDRAW 1\nCHECKDRAW 2\nMOVE 1 10 5\nRESIZE 1 400 220\nSELECT 1\nDBLCLICK 1\nHANDLE se 20 10\nSAVE {}\nDELETE 2\nLOAD {}\nCOUNT\nLIST\nPLACE_ALL\nCOUNT\nQUIT\n",
|
||||
saved.display(),
|
||||
saved.display()
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
let out = Command::new(layout_bin())
|
||||
.args(["--script"])
|
||||
.arg(&script)
|
||||
.args(["--log"])
|
||||
.arg(&log)
|
||||
.env("DISPLAY", ":92")
|
||||
.env("LIGHTGUI_LAYOUT_STATE", &state)
|
||||
.output()
|
||||
.expect("run layout --script");
|
||||
let log_text = std::fs::read_to_string(&log).unwrap_or_default();
|
||||
let _ = xvfb.kill();
|
||||
let _ = xvfb.wait();
|
||||
assert!(
|
||||
out.status.success(),
|
||||
"layout script rc={:?}\nlog:\n{}",
|
||||
out.status.code(),
|
||||
log_text
|
||||
);
|
||||
assert!(
|
||||
log_text.contains("OK CHECKDRAW 1 GtkButton nonwhite="),
|
||||
"log:\n{}",
|
||||
log_text
|
||||
);
|
||||
assert!(
|
||||
log_text.contains("BLANK-EXPECTED"),
|
||||
"GtkInvisible should be BLANK-EXPECTED\nlog:\n{}",
|
||||
log_text
|
||||
);
|
||||
assert!(
|
||||
log_text.contains("OK PLACE_ALL 547/547"),
|
||||
"log:\n{}",
|
||||
log_text
|
||||
);
|
||||
assert!(
|
||||
log_text.contains("SCRIPT 17 commands, 0 failures"),
|
||||
"log:\n{}",
|
||||
log_text
|
||||
);
|
||||
// State file must hold 2 loaded + 547 PLACE_ALL widgets.
|
||||
let state_text = std::fs::read_to_string(&state).unwrap_or_default();
|
||||
assert_eq!(state_text.lines().count(), 549, "state lines");
|
||||
let _ = std::fs::remove_file(&script);
|
||||
let _ = std::fs::remove_file(&log);
|
||||
let _ = std::fs::remove_file(&saved);
|
||||
let _ = std::fs::remove_file(&state);
|
||||
}
|
||||
@@ -34,7 +34,6 @@ modules:
|
||||
- cargo --offline build --release --verbose
|
||||
- install -Dm755 target/release/lightgui-designer /app/share/lightgui-rust/lightgui-designer
|
||||
- install -Dm755 target/release/xframe-palette /app/share/lightgui-rust/xframe-palette
|
||||
- install -Dm755 target/release/xframe-layout /app/share/lightgui-rust/xframe-layout
|
||||
- mkdir -p /app/share/lightgui-rust/widgets/icons
|
||||
- cp lightgui-icons/widgets/icons/* /app/share/lightgui-rust/widgets/icons/
|
||||
- install -Dm755 flatpak/lightgui-rust-launcher /app/bin/lightgui-rust
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
# LightGUI Rust Flatpak launcher — start the combined IDE
|
||||
# (designer + XFrame palette + layout), mirroring the C `ide` script.
|
||||
# LightGUI Rust Flatpak launcher — start the designer.
|
||||
# The canvas lives inside the designer now (no separate layout
|
||||
# process); the XFrame palette is a separate crate but is not
|
||||
# launched — palette selection happens in-process in the designer.
|
||||
# Binaries and icons live under /app/share/lightgui-rust/.
|
||||
ROOT=/app/share/lightgui-rust
|
||||
export LIGHTGUI_ICONS="$ROOT/widgets/icons"
|
||||
@@ -10,23 +12,4 @@ if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PAL_PID=""
|
||||
LAY_PID=""
|
||||
cleanup() {
|
||||
[ -n "$PAL_PID" ] && kill "$PAL_PID" 2>/dev/null
|
||||
[ -n "$LAY_PID" ] && kill "$LAY_PID" 2>/dev/null
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
(cd "$ROOT" && ./xframe-palette) &
|
||||
PAL_PID=$!
|
||||
(cd "$ROOT" && ./xframe-layout) &
|
||||
LAY_PID=$!
|
||||
|
||||
(cd "$ROOT" && ./lightgui-designer) &
|
||||
DESIGNER_PID=$!
|
||||
wait "$DESIGNER_PID"
|
||||
STATUS=$?
|
||||
cleanup
|
||||
trap - EXIT INT TERM
|
||||
exit "$STATUS"
|
||||
exec "$ROOT/lightgui-designer" "$@"
|
||||
Reference in new issue
Block a user