Commit Graph
4121 Commits
Author SHA1 Message Date
trurl 52fc9eec43 Clean up bindgen invocation for WINGs somewhat.
This is still a mess, but it's not all in one big line now.

Going forward, commits that need new bindgen functions and types should put them on their own lines. That will make it easier to figure out which commit introduced the use of a given symbol.
2026-04-06 19:27:30 -04:00
trurl d2a42971c8 Name the anonymous enum for WMButton behaviors.
This is needed so that bindgen cann refer to the enum properly when generating a corresponding Rust type.
2026-04-06 19:27:30 -04:00
trurl d02d67ec61 Eliminate accidentally commited temporary file. 2026-04-06 19:27:30 -04:00
trurl b1eca604b2 Fix false positive improper_ctypes warnings for structs that are opaque types from C. 2026-04-06 19:27:30 -04:00
trurl 797ef1ace8 Fix false positive improper_ctypes warnings for structs that are opaque types from C (#27)
This should be simple enough not to need further review. It gets rid of a bunch of warnings about struct fields defined with Rust-only types which are not visible from C.

Reviewed-on: #27
2026-04-05 19:58:39 -04:00
trurl b5e94932c9 Update snapshot test of font panel rendering.
This accounts for a bugfix in array iteration, which had been causing font entries to be duplicated.
2026-03-31 11:20:46 -04:00
trurl efec1e8d1e Fix off-by-one error in WMArray iteration macro behavior 2026-03-31 11:17:36 -04:00
trurl 2aa0b0bf53 Create an integration test for the WMFontPanel widget. 2026-03-26 23:48:29 -04:00
trurl d4c8f986a6 Bump to public insta-image crate. 2026-03-26 23:47:15 -04:00
trurl ec1761f4f3 Utilities for X11 image capture and acceptance testing.
These are put in their own crate so that we can link tests against libwings freely.

Once libwings is entirely rewritten in Rust, we should be able to move these tests back into the wings-rs crate.
2026-03-26 16:59:23 -04:00
trurl 32cf67b012 Fix panic when a handler triggers handler scheduling. 2026-03-07 21:19:00 -05:00
trurl ee28e9d0a2 Drop debugging print that was committed by accident. 2026-03-02 12:22:22 -05:00
trurl e882fd1f13 Make WMCreateCommandButton into a proper function instead of a macro. 2026-03-02 12:18:21 -05:00
trurl eaabf7e20c Fix panic when notification dispatch triggers notification dispatch.
The global `NotificationCenter` is kept behind a mutex, which was locked when notifications were dispatched.

As a result, if notification dispatch triggered dispatch of other notifications, we would fail to unlock the mutex and panic.

This change copies dispatch instructions out from inside the mutex, releases the mutex, and then actually does the dispatch.
2026-03-02 12:12:25 -05:00
trurl 7c7b9aa97c Rewrite WINGs handlers.c in Rust. 2026-02-15 23:15:22 -05:00
trurl 223a64286f Remove WINGs input handlers.
Input handlers date back to early versions of WINGs. They provide
a way to listen for state changes on file descriptors (including
networking sockets) as part of the WINGs event loop.

This functionality is not actually used in the Window Maker source
tree. It may have been more useful in the past, when WINGs provided
a networking socket API. The status quo appears to be that this is
largely dead code. Pumping the X11 event queue is special-cased in
the input handling code, so it can stay in for now.
2026-02-12 12:53:14 -05:00
trurl ce97a3b39f Drop select(2)-based input FD polling.
This is an intermediate step in the process of dropping input FD
polling entirely (except for pumping the X11 event queue).

There is code to use poll(2) instead of select(2) to wait for events
on file descriptors (which includes waiting for events from the X11
event queue). It appears not to have been used in quite some time,
or perhaps never, as it contains a typo (`poll fd` instead of `pollfd`
on its first line).

To reduce code bloat and make source code easier to navigate, it
makes sense to prefer only one of these codepaths.

After correcting this typo, waiting for X11 events appears to work, so
the poll(2)-based code seems to be good enough. Keeping the poll-based
code is vaguely preferable because poll(2) has a slightly better
interface than select(2), and poll(2) has been a standard Unix API
for 30 years.

Since this code is slated to be replaced, the decision to use the
poll(2)-based code here is probably not very important. But future
programmers may want to use this as a branching-off point for switching
to epoll(7) or some other, less-select(2)-like interface.
2026-02-12 12:53:14 -05:00
trurl 5075c877fa Remove WMDeleteTimerWithClientData.
This function requires tracking an explict client data pointer, which it would be preferable not to have in the Rust rewrite.

Removing this function entails tracking timer handlers explicitly, but this is not an undue burden.
2026-02-12 12:53:14 -05:00
trurl fa67563c2b Break out Sendable into its own utility module. 2025-12-20 13:09:32 -05:00
trurl 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
trurl d46810291b Remove unused import. 2025-12-20 12:38:29 -05:00
trurl 7c875284dc Add build-generated files to .gitignore. 2025-12-20 12:35:10 -05:00
trurl 52db12fbf2 Merge pull request 'Merge refactor/wings-rs into refactor/riir' (#13) from refactor/wings-rs into refactor/riir
Reviewed-on: #13
2025-12-15 13:03:10 -05:00
trurl b2481cf657 Name arguments directly instead of aping the Google C++ style guide. 2025-12-15 13:00:00 -05:00
trurl c371e26d05 Add new Rust source files to Makefile.am.
Forgot to do this earlier.
2025-12-15 13:00:00 -05:00
trurl 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
trurl 9e49ed98a2 Make WINGs configuration visible from Rust. 2025-12-15 13:00:00 -05:00
trurl 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
trurl d33c05ef08 Ignore target dir for nested Cargo subdirs, too. 2025-12-15 13:00:00 -05:00
trurl 79873413db Tweak build so that WINGsP.rs gets generated at the right time. 2025-12-15 13:00:00 -05:00
trurl 57ac6b8178 Put the font and y (ascent) fields of W_Font behind accessors. 2025-12-15 13:00:00 -05:00
trurl d30fe6182d Mark wings-rs as a staticlib. 2025-12-15 13:00:00 -05:00
trurl 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
trurl ee71db6693 Remove unused functions WMSetWidgetDefaultFont, WMSetWidgetDefaultBoldFont. 2025-12-15 13:00:00 -05:00
trurl 01c7eb7275 Remove unused function WMCopyFontWithStyle. 2025-12-15 13:00:00 -05:00
trurl fa99c12fd7 Remove unused function WMIsAntialiasingEnabled. 2025-12-15 13:00:00 -05:00
trurl d7e815010b Merge pull request 'Merge refactor/wutil-rs into refactor/riir' (#12) from trurl/wmaker:refactor/wutil-rs into refactor/riir
Reviewed-on: #12
2025-12-15 12:50:52 -05:00
trurl a31fa582bd Merge branch 'refactor/riir' into refactor/wutil-rs 2025-12-15 12:49:49 -05:00
trurl d3dac752cc Indent with tabs, as is standard for this file. 2025-12-08 13:31:05 -05:00
trurl 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
trurl d8057575ce Use a helper method for adding notification listeners. 2025-12-08 13:14:12 -05:00
trurl d8912c58e6 Fix typo in comment. 2025-12-08 13:06:58 -05:00
trurl b7f765e3f6 Rewrite WINGs/notification.c in Rust. 2025-12-08 13:06:04 -05:00
trurl 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
trurl 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
trurl 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
trurl 0c4d78a53d Drop unused macro (dead code) that invokes WMCreateNotification. 2025-12-08 13:05:20 -05:00
trurl 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
trurl 0097d1819e Move functions on Bag which were only called by FFI code inline. 2025-12-08 13:00:14 -05:00
trurl 8270124869 Nix dead code that was left commented out. 2025-12-08 13:00:14 -05:00