1
0
forked from vitrine/wmaker
Commit Graph

4102 Commits

Author SHA1 Message Date
cd711ba52b Restore function prototype for W_ClearNotificationCenter.
This was mistakenly removed when writing wutil-rs/src/notification.rs.
2025-12-20 12:38:29 -05:00
d46810291b Remove unused import. 2025-12-20 12:38:29 -05:00
7c875284dc Add build-generated files to .gitignore. 2025-12-20 12:35:10 -05:00
52db12fbf2 Merge pull request 'Merge refactor/wings-rs into refactor/riir' (#13) from refactor/wings-rs into refactor/riir
Reviewed-on: vitrine/wmaker#13
2025-12-15 13:03:10 -05:00
b2481cf657 Name arguments directly instead of aping the Google C++ style guide. 2025-12-15 13:00:00 -05:00
c371e26d05 Add new Rust source files to Makefile.am.
Forgot to do this earlier.
2025-12-15 13:00:00 -05:00
98421afc38 Rewrite all functions from WINGs wfont.c in Rust.
This starts to establish the structure for an in-place rewrite of WINGs. An
actual redesign of WINGs may follow, but for now there are no plans to alter the
structure of WINGs substantially.
2025-12-15 13:00:00 -05:00
9e49ed98a2 Make WINGs configuration visible from Rust. 2025-12-15 13:00:00 -05:00
a466f17c35 Fix build order issues by moving wings-rs/ into WINGs/.
Having wings-rs depend on WINGs/WINGs/WINGsP.h was not working very well if all
of WINGs/ had to be built before wings-rs/. Moving wings-rs/ into WINGs/
addresses this.
2025-12-15 13:00:00 -05:00
d33c05ef08 Ignore target dir for nested Cargo subdirs, too. 2025-12-15 13:00:00 -05:00
79873413db Tweak build so that WINGsP.rs gets generated at the right time. 2025-12-15 13:00:00 -05:00
57ac6b8178 Put the font and y (ascent) fields of W_Font behind accessors. 2025-12-15 13:00:00 -05:00
d30fe6182d Mark wings-rs as a staticlib. 2025-12-15 13:00:00 -05:00
e20009a880 Use bindgen to generate Rust bindings for WINGs types.
We will use these to port W_Font, W_Screen, etc., to Rust.

Bindings are regenerated whenever the relevant C source files change and then
patched to make sure they will build. This is a bit hacky but will serve our
purposes: the struct definitions should be migrated to Rust sooner rather than
later, so the hackishness should be transient.
2025-12-15 13:00:00 -05:00
ee71db6693 Remove unused functions WMSetWidgetDefaultFont, WMSetWidgetDefaultBoldFont. 2025-12-15 13:00:00 -05:00
01c7eb7275 Remove unused function WMCopyFontWithStyle. 2025-12-15 13:00:00 -05:00
fa99c12fd7 Remove unused function WMIsAntialiasingEnabled. 2025-12-15 13:00:00 -05:00
d7e815010b Merge pull request 'Merge refactor/wutil-rs into refactor/riir' (#12) from trurl/wmaker:refactor/wutil-rs into refactor/riir
Reviewed-on: vitrine/wmaker#12
2025-12-15 12:50:52 -05:00
a31fa582bd Merge branch 'refactor/riir' into refactor/wutil-rs 2025-12-15 12:49:49 -05:00
d3dac752cc Indent with tabs, as is standard for this file. 2025-12-08 13:31:05 -05:00
0893be1cea Use BTreeMap instead of HashMap for notification subscriptions.
This allows us to initialize the global NotificationCenter singleton in a const
context, which eliminates the need for OnceLock.
2025-12-08 13:24:44 -05:00
d8057575ce Use a helper method for adding notification listeners. 2025-12-08 13:14:12 -05:00
d8912c58e6 Fix typo in comment. 2025-12-08 13:06:58 -05:00
b7f765e3f6 Rewrite WINGs/notification.c in Rust. 2025-12-08 13:06:04 -05:00
d88d626fbe Remove direct creation and posting of notifications from WINGs.
We can reduce the WMNotification API surface area further by getting rid of
WMCreateNotification and WMPostNotification. WMNotification remains a
first-class object, but it is no longer possible for client code to create a
notification object directly. Notifications must now be posted through
WMPostNotificationName, which handles notification creation and destruction on
its own.

This will simplify the notification lifecycle and make the Rust rewrite
simpler. (Notifications no longer need to be reference-counted, heap-allocated
objects that might be saved somewhere after they are dispatched.)

WTextField code which reused the WMNotification struct has been modified to take
parameters of the correct type directly, instead of through a WMNotification's
void* data field.
2025-12-08 13:05:20 -05:00
5847e9d68f Ditch the notification function WMRemoveNotificationObserverWithName.
This reduces the notification API in a way that is helpful for rewriting in
Rust. This function is only used in one place, and the object that is being
deregistered is free'd immediately after WMRemoveNotificationObserverWithName is
called, so it should be safe just to use WMRemoveNotificationObserver (since I
hope it's an error to keep a notification to a free'd object registered).
2025-12-08 13:05:20 -05:00
adb967ab15 Drop dead notification queue code.
This appears to have been used by now-defunct support for network
connections (WMConnection). No live code instantiates a notification queue or
pushes/dequeues notifications from a notification queue. (The global
NotificationCenter in WINGs/notification.c is still in use, so it is not going
anywhere in this commit.)
2025-12-08 13:05:20 -05:00
0c4d78a53d Drop unused macro (dead code) that invokes WMCreateNotification. 2025-12-08 13:05:20 -05:00
dcd45f0677 Make some unused public WMNotification APIs private.
`WMRetainNotification`, `WMGetDefaultNotificationQueue`,
`WMDequeueNotificationMatching`, `WMEnqueueNotification`, and
`WMEnqueueCoalesceNotification`, are only used in WINGs/notification.c. To
reduce the API surface area that needs to be migrated to Rust, they are being
made private.
2025-12-08 13:05:20 -05:00
0097d1819e Move functions on Bag which were only called by FFI code inline. 2025-12-08 13:00:14 -05:00
8270124869 Nix dead code that was left commented out. 2025-12-08 13:00:14 -05:00
89183f3bcb Rewrite WMBag in Rust.
We should eventually get rid of this entirely, in favor of something along the
lines of a sorted Vec that is fully typed (so the payload isn't just a void*).
2025-12-08 13:00:14 -05:00
46e540b1b1 Prune the WMBag API in preparation for rewriting it in Rust. 2025-12-08 13:00:14 -05:00
9802b684ae Rewrite WINGs/tree.c in Rust.
This is a bit of a red herring, since WMTree is only used in wmmenugen, which I
don't think I've ever directly used. See notes at the top of tree.rs for more
musings on whether this should be in wutil-rs at all.
2025-12-08 12:48:37 -05:00
0a04a4c12e Remove depthFirst parameter from WMTreeWalk.
WMTreeWalk is only called once, with depthFirst set to true, so we might as well
just hard-code that behavior.

Also, this parameter appears to have been misnamed (since the search is always DFS)
and should properly be named to indicate that it controls if this is a pre- or
post-order traversal.
2025-12-08 12:47:39 -05:00
e1a263cc5b Prune unused WMTree API functions.
This is a first step towards migrating WINGs/tree.c to Rust.

Happy finding: no parent pointer are actually needed, so we don't have to use a
shared structure for node pointers!
2025-12-08 12:47:39 -05:00
c298b5f96f Avoid an unnecessary allocation in wtrimspace. 2025-12-08 12:40:33 -05:00
dfd77b11a9 Don't scan ahead unnecessarily in wstrndup. 2025-12-08 12:40:33 -05:00
927cc93e0a Add string.rs to Makefile.am for wutil-rs.
Without this, `make` won't automatically rebuild wutil-rs when string.rs
changes.
2025-12-08 12:40:33 -05:00
d2046de7ff Unit tests for wtokenjoin. 2025-12-08 12:40:33 -05:00
a7a44397a4 Rewrite all functions from WUtils string.c in Rust.
These functions should be gotten rid of as we transition to Rust, but replacing
them with minimally tested Rust code should suffice as a first step.
2025-12-08 12:40:33 -05:00
72a1f8cb9e Throw some comments around the FST table for tokenizing command line.
This is slated for replacement, but it will help to be better documented first.
2025-12-08 12:40:33 -05:00
60902b9222 Use system strlcpy/strlcat instead of packaging our own.
These functions were added to glibc 2.38, so we don't even need to check for
libbsd. There isn't a strong need to worry about supporting older systems
because use of these functions should go away as we rewrite string.c in
Rust. And, apparently, they are not held in high regard historically. That's at
least 2 reasons to be rid of them.
2025-12-08 12:40:33 -05:00
e0fc92bf51 Fix omissions in WMHashEnumerator C interface.
The WMHashTable rewrite branch was prematurely merged. This patch fixes some of
the things that were overlooked in that merge. WMHashEnumerator should be an
opaque type that is free'd after it is created.

We hope to axe WMHashTable entirely, but it's reasonable to get this fix in for
now so that the WMFontPanel integration test in WINGs/Tests can run on top of
the changes we've made so far. As of this commit, it's still broken, but it
behaves better than it did.
2025-11-29 12:51:51 -05:00
f8df6447ea Store addresses insead of pointers in WMArray.
Prior to this patch, when WINGs/Tests/wtest.c tries to build a FontPanel, it
crashes. This is because the rewritten WMSortArray passes pointers to array
items to its comparator function, but the original API passed pointers to
pointers to array items to its comparator function. This has been corrected, and
now WMSortArray should behave more like it originally did.

This patch also stores `usize` addresses instead of `NonNull` pointers because
some WMArray use sites actually store non-pointer data (by casting it to
uintptr_t or similar).
2025-11-29 12:51:51 -05:00
bd18e0c600 add some hacky lines to start-captive-wmaker.sh to ease debugging of X11 integration from Emacs 2025-11-21 16:01:41 -05:00
50caed30c0 Add a wings-rs crate for porting WINGs proper to Rust. 2025-11-14 01:07:40 -05:00
46af2c27ee Tweak start-captive-wmaker.sh to behave a little more nicely.
* Select $DISPLAY dynamically because X11 likes :0 and Wayland likes :1 and who
knows what else might like some other value.
* Kill Xephyr after wmaker exits.
* 640x480 should be big enough for anyone. (And the window shouldn't get in the
way so much.)
2025-10-28 21:30:34 -04:00
026426e6c3 Remove VoidPointer impls that were commented out in previous commit. 2025-10-25 12:41:52 -04:00
564501953f Use wfree instead of XFree in a few more places.
This fixes some crashes found in cursory smoke tests. You can now open and close
some windows without crashing immediately.
2025-10-25 01:53:23 -04:00