Commit graph

294 commits

Author SHA1 Message Date
Jonathan Johnson
cdef6bcbc3
Removed unnecessary bytemuck usage
This was copy-pasted from a Buffer<T> implementation that was removed
from Kludgine, since Buffer<T> isn't public.
2024-01-03 11:41:26 -08:00
Jonathan Johnson
be0399279c
Initial implementation of offscreen rendering 2024-01-03 11:35:43 -08:00
Jonathan Johnson
244797110e
Added to_ variants for into_ functions 2024-01-02 15:07:06 -08:00
Jonathan Johnson
8bcbad959b
Regenerating readmes 2024-01-02 14:40:41 -08:00
Jonathan Johnson
83e44912ee
ReadOnly<T>, Owned<T>, IntoSource<T>, more
Closes #98

This finishes my initial refactoring of the dynamic system to add
support for several dataflows including:

- Pure data sources that can be implemented using an `Owned<T>` at the
  root of a graph of `Dynamic<U>`/`DynamicReader<U>`s.
- Read-only data sinks. I thought this would be more useful across other
  widgets, but in general, Progress and Label seem like the only types
  that this applies to currently.
- The ability to mix/match Dynamic/DynamicReader in tuple-based
  for_each/map_each.
2024-01-02 14:36:53 -08:00
Jonathan Johnson
8b19c4c304
Fixing doctests 2024-01-02 09:18:18 -08:00
Jonathan Johnson
276ba97bf7
Actually clamping on f32 div
For some reason I forgot about 1.0 being an edge case, but I also didn't
think about negatives either. Applying a clamp is the right move here.

Refs #120
2024-01-02 09:16:21 -08:00
Jonathan Johnson
e70e92726c
Source<T> + Destination<T> (breaking)
Refs #98

This refactor overhauls the reactive system to move all the reactive
methods to traits. The side effect of this change is that now
DynamicReader's API is the same as Dynamic's API, but because it only
implements Source<T>, DynamicReader does not offer any mutation
functions.

While it's unfortunate to have more traits to include to use Cushy, this
seems like the best option, and it offers a path to try to integrate
this into the tuple ForEach/MapEach traits. Unfortunately, my attempt at
doing those in this set of changes led to issues specifying generic
associated lifetimes for the DynamicGuard. But, I was also in the middle
of this larger refactoring, so it might be that a fresh attempt will
succeed.
2024-01-02 09:00:29 -08:00
Jonathan Johnson
c1d6e3f7fd
Fixed Switcher widget
This was broken in unreleased changes, hence no changelog update.
2024-01-02 08:37:10 -08:00
Jonathan Johnson
36d4239df5
CI: Working on CI
(This message may be repeated while I debug github actions errors)
2024-01-01 13:45:53 -08:00
Jonathan Johnson
9786852bf6
Ci: Trying alternate way to pass version 2024-01-01 13:44:43 -08:00
Jonathan Johnson
f0e1118719
Switching test CI to a matrix
Also adding Mac
2024-01-01 13:39:48 -08:00
Jonathan Johnson
aa790d0411
Disambiguating image reference
When building tests, dev-dependencies include image which apparently is
ambiguous in 1.70.0.
2024-01-01 13:04:51 -08:00
Jonathan Johnson
912d5566bc
Attempting to add Windows CI 2024-01-01 13:00:55 -08:00
Jonathan Johnson
4d94bccfa6
Restoring MSRV 1.70.0
Fixes #120
2024-01-01 12:55:18 -08:00
Jonathan Johnson
f56e8b7e29
Adding MSRV CI job 2024-01-01 12:48:48 -08:00
Jonathan Johnson
a9a41a1582
Refactored Dymamics to be weak + drop bug fixes
After adding weak_clone, I realized that all map functions should use
weak references anyways. In the process of implementing this, I ran
tests a lot and found other edge cases where I hadn't properly reasoned
about Drop behavior.

While some of the state cleanup is a bit overkill at the moment, this is
in anticipation of wanting a WeakDynamicReader-like type.
2024-01-01 12:35:21 -08:00
Jonathan Johnson
e4dfd9320d
Fixed a possible deadlock in block_until_updated
The animation doctest randomly failed on me this morning, and I isolated
it to the order of the two mutexes. There's no reason to hold the
deadlock mutex for more than the check for deadlock, so I switched which
mutex the condvar is synchronizing using to ensure that another thread
couldn't cause a deadlock by dropping a DynamicMutexGuard while the
block_until_updated thread is performing its state check.
2023-12-31 10:21:45 -08:00
Jonathan Johnson
be483a92bd
Fix clippy warning 2023-12-31 07:51:10 -08:00
Jonathan Johnson
d739ef1b79
Added checks to ZeroToOne division
Refs #120
2023-12-31 07:50:26 -08:00
Jonathan Johnson
0fb93c7be8
ZeroToOne now checks when dividing
Refs #120
2023-12-31 07:36:54 -08:00
Jonathan Johnson
15960da098
Fixing edge case in DynamicReader disconnect
There was a small window between when notify_all and the strong count
for the Arc is decreased that a DynamicReader could observe the strong
count still being greater than the reader count, but the drop thread
just hasn't proceeded far enough.

Now the on_disconnect is stored in an option, and its presence denotes
that the disconnect logic has not fired yet. DynamicReader now checks
on_disconnect in addition to the strong count.
2023-12-29 14:23:49 -08:00
Jonathan Johnson
32d6fffd3b
WidgetRef::unmount_in
This should be all the locations that WidgetRef::unmount_in should be
called.
2023-12-29 13:59:28 -08:00
Jonathan Johnson
9e4e079bf5
WindowLocal + Custom Observers
This cascaded into a lot more work than expected. However, in general,
if one clones a `WidgetInstance` and shares it between two windows, it
should now work. Widget authors must ensure that when they cache
information, they do so with either a `WidgetCacheKey` or use a
`WindowLocal<T>` if per-window state is desired.

This is demonstrated in the debug-window example, where the counter of
open windows is next to a clone of the same button from the main window
that opens a new window.
2023-12-29 13:21:39 -08:00
Jonathan Johnson
999f920f8c
Empty debug contexts are automatically cleaned up 2023-12-29 08:55:24 -08:00
Jonathan Johnson
3fc49d2424
Initial DebugContext implementation 2023-12-28 21:30:25 -08:00
Jonathan Johnson
c6d66a3166
Grid remove fix, new dynamic features 2023-12-28 17:36:52 -08:00
Jonathan Johnson
285c92f82b
Root tab order fix, Spacebar widget activiation
Closes #99

Disclose now accepts focus and responds to spacebar as a result of this.
2023-12-28 15:48:34 -08:00
Jonathan Johnson
a0478e266a
Added Disclose widget 2023-12-28 14:12:26 -08:00
Jonathan Johnson
2fe28729df
Directly depending on figures
While this was a workaround for a docs.rs issue (Px/Lp are not
linked), I decided having the shorter import path would look better in
the examples.

It probably wasn't necessary to update all of the references in the
internal code, but I decided it was worth the consistency.
2023-12-28 09:35:24 -08:00
Jonathan Johnson
98f8d3a43d
Preparing v0.2.0 2023-12-27 19:08:34 -08:00
Jonathan Johnson
f73452c880
Updating Kludgine 2023-12-27 19:04:41 -08:00
Jonathan Johnson
df479e983e
Renaming crate to Cushy
Refs #117
2023-12-27 19:02:59 -08:00
Jonathan Johnson
a9dcee38a6
Validation callbacks are now cleaned up
Closes #105
2023-12-27 14:25:14 -08:00
Jonathan Johnson
f85b2f988b
Added Default components
Closes #116
2023-12-27 13:44:34 -08:00
Jonathan Johnson
8a9fb24fe0
Added PendingWindow
Closes #107

This answers the question of how a window can close itself.
2023-12-27 09:47:58 -08:00
Jonathan Johnson
17c6f2ef83
Updated changelog 2023-12-27 09:10:08 -08:00
Jonathan Johnson
76528ee374
Merged internal and public WindowHandle types 2023-12-27 09:04:29 -08:00
Jonathan Johnson
aa47539518
Using glyph end instead of incrementing start
Closes #112

This removes the last manual byte change I can find. While what the user
reported was that this was causing incorrect selection, using the arrow
keys when in this situation could lead to a panic, because the offset
was not a valid character offset.
2023-12-27 08:32:26 -08:00
Jonathan Johnson
884febecfa
Added WindowHandle
Closes #109
2023-12-27 08:10:44 -08:00
Jonathan Johnson
492da3b6ed
Updated dependencies 2023-12-26 22:27:22 -08:00
Jonathan Johnson
4379565e3d
Label/Input caches invalidate across windows
When combined with changes in Kludgine, this should round out support
for sharing content between multiple windows.

Closes #110
2023-12-26 13:57:23 -08:00
Jonathan Johnson
180232261a
Label now ensures pixel alignment for its text
This is also paired with a fix in Kludgine.
2023-12-26 06:35:49 -08:00
Jonathan Johnson
04fca53182
Fixing doc urls for rustme 2023-12-25 08:02:36 -08:00
Jonathan Johnson
cb65b014a3
Updated docs url 2023-12-25 07:59:40 -08:00
Jonathan Johnson
e813f168f8
Switching to Dossier for docs 2023-12-25 07:43:54 -08:00
Jonathan Johnson
443c5b40d1
Fix: Click selection across merged glpyhs
Closes #112
2023-12-24 16:57:53 -08:00
Jonathan Johnson
470267ccfe
Input selection constraining
Closes #113
2023-12-24 08:26:09 -08:00
Jonathan Johnson
8d3a4a42cf
Updating Kludgine
This fixes a few issues, the most important being a crash when a window
is minimized
2023-12-22 12:18:04 -08:00
Jonathan Johnson
6b33b0f686
Fixed reference cyle in ManagedWidget 2023-12-22 09:51:06 -08:00