1
0
forked from vitrine/wmaker
Commit Graph

4127 Commits

Author SHA1 Message Date
e2f84aea25 Rewrite WMFontPanel in Rust. 2026-04-05 20:52:50 -04:00
2a83b08f0c Add allow(non_snake_case) for WMList and WMButton FFI functions. 2026-04-05 20:44:26 -04:00
c79b5853a4 Start porting the base WINGs widget type to Rust.
Porting WINGs widgets to Rust will require using some WINGs abstractions. One of them is the base widget type, which is implemented by giving all widgets a common layout (with the first two fields always being the same basic types).
2026-04-05 20:01:53 -04:00
d4168b821e Reimplement the WMAddListItem macro in Rust.
This was originally a macro in C. We reimplement it as a Rust function.
2026-04-05 20:01:53 -04:00
6c72da0490 Reimplment the WMCreateCommandButton macro in Rust.
This is a macro in C, and it would be helpful to be able to do the same thing in Rust. It is simply ported over as a Rust function.
2026-04-05 20:01:53 -04:00
975089b963 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-05 20:01:53 -04:00
bf8a35e44a 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-05 20:01:53 -04:00
9933450b63 merge upstream 2026-04-05 20:01:18 -04:00
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: vitrine/wmaker#27
2026-04-05 19:58:39 -04:00
5883e0d8a3 Eliminate accidentally commited temporary file. 2026-04-05 19:57:14 -04:00
7878215c19 Fix false positive improper_ctypes warnings for structs that are opaque types from C. 2026-04-05 13:15:53 -04:00
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
efec1e8d1e Fix off-by-one error in WMArray iteration macro behavior 2026-03-31 11:17:36 -04:00
2aa0b0bf53 Create an integration test for the WMFontPanel widget. 2026-03-26 23:48:29 -04:00
d4c8f986a6 Bump to public insta-image crate. 2026-03-26 23:47:15 -04:00
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
32cf67b012 Fix panic when a handler triggers handler scheduling. 2026-03-07 21:19:00 -05:00
ee28e9d0a2 Drop debugging print that was committed by accident. 2026-03-02 12:22:22 -05:00
e882fd1f13 Make WMCreateCommandButton into a proper function instead of a macro. 2026-03-02 12:18:21 -05:00
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
7c7b9aa97c Rewrite WINGs handlers.c in Rust. 2026-02-15 23:15:22 -05:00
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
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
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
fa67563c2b Break out Sendable into its own utility module. 2025-12-20 13:09:32 -05:00
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