Commit Graph
4035 Commits
Author SHA1 Message Date
trurl dfdaa67b4d Chasing memory bugs in memory.rs: allocate the right layout. 2025-10-23 14:46:56 -04:00
trurl e6fd7e49f8 Clean things up a little bit with refutable let. 2025-10-23 14:46:56 -04:00
trurl 12930739ec Allocate PropList description with memory::alloc_bytes.
All memory allocations passed back from FFI functions should be allocated with
`memory::alloc_bytes`, so that C code can call `memory::free_bytes` when it's
done with them.
2025-10-23 14:46:56 -04:00
trurl cf588d6e27 Simplify path_from_cstr substantially (h/t cross). 2025-10-23 14:46:56 -04:00
trurl f3961ba66f Reimplement the PropList data structure in Rust.
While this large change has some unit tests, it has not been integration tested
thoroughly. Removing the global case insensitivity flag may be an issue in
particular.

A few of PropList API functions have been modified (mostly to get rid of
varargs). The definition of one such function has been left in C for cleanup
later.
2025-10-23 14:46:56 -04:00
trurl 5b593fb19a Expose the GSUSER_SUBDIR preprocessor symbol to Rust.
This symbol's value must be known to port `wmkdirhier` and `wrmdirhier` from
`proplist.c` to Rust.

This change introduces a basic C library under wutil-rs that is linked into the
Rust code to expose preprocessor symbols and other Autotools configuration
decisions to Rust. See the rust rewrite notes at the top of
`wutil-rs/src/defines.rs` for further thoughts.
2025-10-23 14:46:56 -04:00
trurl f2e9123db6 Port WINGs data.c (WMData) to Rust.
This is not tested super well, but I hope we can be rid of it soon enough. (Once
we have WMPropList migrated, WMData and other WINGs data structures should be
easier to prune.)
2025-10-23 14:46:56 -04:00
trurl 791149fe70 Correct oversight in how WMMapArray is supposed to work. 2025-10-23 14:46:56 -04:00
trurl 52b0e6b182 Drop WMData's destructor field.
WMData always owns its data and allocates it with wmalloc, so we can always free
it with wfree (and don't need to call anything else).
2025-10-23 14:46:56 -04:00
trurl bbcf40ee47 Eliminate the WINGs function WMCreateDataWithBytesNoCopy.
This constructor was only needed in one particular place. We can duplidate the
data instead of borrowing it. This ensures that WMData always owns its data
segment, which simplifies porting to Rust significantly.
2025-10-23 14:46:56 -04:00
trurl 9d07e2d3d8 Eliminate the unused WINGs function WMGetSubdataWithRange. 2025-10-23 14:46:56 -04:00
trurl dea8c36cd5 Eliminate the unused WINGs function WMCreatePLDataWithBytesNoCopy. 2025-10-23 14:46:56 -04:00
trurl 3beadbb6cb Forgot to add new array.rs impl. 2025-10-23 14:46:56 -04:00
trurl dd36130730 Fix const qualifier on strings returned by wgethomedir. 2025-10-23 14:46:56 -04:00
trurl 6ede7a5cb0 Reimplement WINGs array.c in Rust.
This is another utility that should not be used in any new (Rust) code. (We
should prefer Vec or something similar.) This should be removed once dependents
are ported to Rust.
2025-10-23 14:46:56 -04:00
trurl 2b9b915768 Replace most WUtil functions in findfile.c with Rust impls.
This is not a bug-for-bug reimplementation, and it may need some shaking down to
ensure that everything still works. Once their dependents are ported, it would
be appropriate to dispose of them.
2025-10-23 14:46:56 -04:00
trurl d50adaa1c8 Use free() on memory returned by FcNameUnparse and hand back wfree-managed pointers from our functions.
This is necessary because we now allocate memory through a special allocator of
our own on the Rust side. Passing raw malloc'd pointers to wfree will break
things.
2025-10-23 14:46:56 -04:00
trurl 5b0ad78f01 Remember to AC_SUBST the Rust compiler environment variables so they're visible in Makefiles. 2025-10-23 14:46:56 -04:00
trurl 46fcbb0ff1 Port custom allocators (WINGs memory.c) to Rust.
This introduces the crate wutil-rs, which is intended to be the destination for
migrating the API of WINGs/WINGs/WUtil.h to Rust.
2025-10-23 14:46:56 -04:00
trurl e3fb8ddbc8 Rip out Boehm GC support.
This is done to simplify memory management across the boundary between C and
Rust. While rewriting WINGs, we may want to be able to malloc/free with the libc
allocator on both sides of that divide.
2025-10-23 14:46:56 -04:00
trurl 59ad67f4dc Provide a janky script for running Window Maker in a captive Xephyr X server.
If this becomes a permanent fixture, hard-coded values should be fixed.
2025-10-23 14:39:53 -04:00
trurl 5325e2d455 Improve automake integration with Rust build.
Now ./configure checks for cargo and rustc, and `make` will rebuild wmaker-rs if
any of its source code has changed.

There are still some steps to take for better integration (like ensuring that
deps are vendored correctly). See
https://viruta.org/librsvgs-build-infrastructure-autotools-and-rust.html for
suggestions on what else to do.
2025-09-19 20:02:54 -04:00
trurl 82c8b0c9b4 Rename wmakerlib dir to wmaker-rs for econsistency with future libs. 2025-09-13 14:54:13 -04:00
trurl a67f7483fd Clean up parameters that were commented out. 2025-09-09 22:27:55 -04:00
trurl cf87f7e83b Finish moving WApplication struct defn and methods into Rust. 2025-09-09 22:23:59 -04:00
trurl b569889f21 Expose RRetainImage from wrlib for Rust. 2025-09-09 22:21:15 -04:00
trurl 383b3a1a7b Expose some WMHandlerID methods from WINGs for Rust. 2025-09-09 22:20:07 -04:00
trurl 4fd7d1e2c1 Forgot to include screen.rs earlier. 2025-09-09 22:19:41 -04:00
trurl 0131c493c0 Expose PropGetWMClass for Rust. 2025-09-09 22:19:16 -04:00
trurl 5f1317b885 Forgot to include global module in lib.rs. 2025-09-09 22:18:49 -04:00
trurl 5817c1f032 Expose a Rust type for WMenu. 2025-09-09 22:18:30 -04:00
trurl 6d09fbff93 Expose wDockFinishLaunch for WApplication. 2025-09-09 22:18:03 -04:00
trurl b38fa197d7 Expose wDefaultFillAttributes for Rust. 2025-09-09 22:17:46 -04:00
trurl 4c617034b4 Expose AppMenu method used by WApplication. 2025-09-09 22:17:22 -04:00
trurl f5daf2a76a Expose WAppIcon methods used by WApplication. 2025-09-09 22:16:31 -04:00
trurl 05895b40a2 Forgot to add wrlib module to lib.rs. 2025-09-09 22:07:37 -04:00
trurl 4f4ef94400 Expose start_hidden and emulate_appicon attrs of WWindow. 2025-09-09 21:57:17 -04:00
trurl 023ab177b2 Expose WWindow attributes so they can be seen from Rust. 2025-09-09 21:56:30 -04:00
trurl 279f369256 Expose w_global.context so it can be seen from Rust. 2025-09-09 20:16:02 -04:00
trurl 0a2ff4f055 Expose various other WWindow fields so they can be seen from Rust.
Fields: client_win, screen_ptr, wm_hints, wm_class, wm_instance,
defined_user_flags.
2025-09-09 19:41:12 -04:00
trurl 108c913c1d Expose WWindow::user_flags so that it can be seen from Rust. 2025-09-09 19:36:36 -04:00
trurl 8c669d57b2 Expose WWindow::net_icon_image so that it can be seen from Rust. 2025-09-09 19:34:57 -04:00
trurl 83fa8119d9 Expose WWindow::main_windowc so that it can be seen from Rust. 2025-09-09 17:00:57 -04:00
trurl 507e69e209 Expose WWindow::fake_group so that it can be seen from Rust. 2025-09-09 16:54:30 -04:00
trurl 70814cc235 Add a module for the WWindow type. 2025-09-09 16:52:21 -04:00
trurl 2ef6720890 Expose WIcon::highlighted so that it can be seen from Rust. 2025-09-09 15:52:33 -04:00
trurl 493d3c9738 Expose WScreen::root_win so that it can be seen from Rust. 2025-09-09 15:49:52 -04:00
trurl 917cc29160 Use repr(C) for Application flags to use them from an FFI interace. 2025-09-09 15:45:57 -04:00
trurl 3234e15388 Move WApplication refcount maintenance into Rust. 2025-09-05 02:24:03 -04:00
trurl 394b4d23cb Add forgotten use std::ptr. 2025-09-05 02:05:04 -04:00