Commit graph

311 commits

Author SHA1 Message Date
Jonathan Johnson
882ec6f4aa
Fixing warnings + missing docs 2024-01-06 14:57:46 -08:00
Jonathan Johnson
e548f1255d
Closing no longer repeats
Closes #108

Turns out there was a property on KeyEvent this whole time... oops.
2024-01-06 14:55:49 -08:00
Jonathan Johnson
cda13c42a2
Guide intro + KeyEvent
Also fixed virtual window's refresh handling.
2024-01-06 14:46:48 -08:00
Jonathan Johnson
31de0bc458
Fixing asset link
And a little more filler
2024-01-06 11:01:56 -08:00
Jonathan Johnson
8fb372e743
Work on guide 2024-01-06 10:26:23 -08:00
Jonathan Johnson
bb28f96b58
Space fix 2024-01-06 10:25:45 -08:00
Jonathan Johnson
1b608b39af
Removing direct winit access
This was a holdover while I was still implementing the PlatformWindow
interface. Cushy widgets shouldn't be able to access winit directly,
otherwise they could cause unwanted effects when not running in a
standalone Cushy app but rather embedded in a game.
2024-01-05 18:17:44 -08:00
Jonathan Johnson
a3e76f6472
Calling set_ime_cursor_location
Currently passing the entire input area because it's easy. Not closing
the issue because the correct thing to do would be to constrain the
location to a smaller area on the current line (or the current line).

Refs #122
2024-01-04 17:08:05 -08:00
Jonathan Johnson
4dc5cb5cc4
Merge pull request #123 from khonsulabs/offscreen
Initial implementation of offscreen rendering
2024-01-04 16:10:33 -08:00
Jonathan Johnson
5a78788396
Enabling animated transparent capture 2024-01-04 16:09:58 -08:00
Jonathan Johnson
6ff766846f
Added CushyWindow
While working on the changelog, I realized I didn't provide a type that
allowed a third party developer to provide a
PlatformWindowImplementation. This type now completes it.
2024-01-04 15:58:29 -08:00
Jonathan Johnson
a197bb5e81
Unit-tested, auto-generated screenshots
This commit adds my first take at creating a harness for a user's guide
using the new capture functionality. The example has tests that ensure
the align widget creates the expected results.
2024-01-04 13:56:45 -08:00
Jonathan Johnson
eb20133116
Reinstating weak_clone and non-weak callbacks
Somehow I missed that my changes for weak callbacks broke the theme
editor. I thought I had it working with the try_get changes, but I
discovered several flaws in this approach.

In the end, ownership has been transferred to the CallbackHandle, and a
CallbackHandle can relinquish its reference to create weak graphs. This
is how weak_clone now works.
2024-01-04 13:56:26 -08:00
Jonathan Johnson
36b80e8f34
Moved frame mapping to its own thread
This ensures frames render consistently.

This change only affects the animation recorder. The regular virtual
recorder interface blocks when refresh is called.
2024-01-03 20:15:00 -08:00
Jonathan Johnson
bc52be440f
Added animation recording + event wiring
Not great, but it technically exists.
2024-01-03 17:45:11 -08:00
Jonathan Johnson
2e2d45d281
Switching wgpu dependencies
This now matches the current CI config on wgpu's repository.
2024-01-03 12:24:22 -08:00
Jonathan Johnson
5a56833cd0
Switching text matrix to continue jobs 2024-01-03 11:44:15 -08:00
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