Commit graph

280 commits

Author SHA1 Message Date
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
Jonathan Johnson
564b9e5a96
Added comments to multi-window
Also made it open a second window before startup
2023-12-21 15:41:34 -08:00
Jonathan Johnson
f1a2a711ff
Multi-window support
Closes #91

There's some details to still figure out, which are in new issues:

- #109: When opening a window, no handle is returned that gives access to the
  window from the opener. Technically this can all be wired up manually,
  with exception of requeesting the window close.
- #107: How can a window close itself? Once we have a handle type, we still
  need a mechanism to allow a button on a window request that the window
  closes gracefully. The examples that currently close the window
  call exit instad.
2023-12-21 14:57:29 -08:00
Jonathan Johnson
4c9e2d5989
Dynamic::compare_swap + Validations now block
This sounds like a regression, but it was masking a "race condition".
DynamicGuard runs the change callbacks on drop in a background thread.
Validations was using the guard to not have to lock twice.

This led to an issue where the invalid count might be non-zero due to
the callbacks not being invoked, preventing the closure from being
invoked even though there are no validation errors.

Introducing compare_swap gives a higher-level API for Validations to
use, and it also ensures the callbacks are able to be run in the current
thread.
2023-12-21 09:12:24 -08:00
Jonathan Johnson
32cd07c241
Validations::validate_result 2023-12-21 08:32:01 -08:00
Jonathan Johnson
641ae3a17d
Debug for WeakDynamic 2023-12-21 07:11:24 -08:00
Jonathan Johnson
2ad583926b
Disabled automatic window growing
Closes #92
2023-12-20 11:41:31 -08:00
Jonathan Johnson
4e145d7f35
Removed UnwindSafe bounds
appit wasn't supposed to pass along this requirement
2023-12-20 11:35:19 -08:00
Jonathan Johnson
2575deecf8
Removed TODOs that are now issues 2023-12-20 11:03:48 -08:00
Jonathan Johnson
9aaf22c903
Preparing v0.1.3 2023-12-19 16:45:51 -08:00
Jonathan Johnson
c0620839c4
Updating changelog 2023-12-19 16:42:53 -08:00
Jonathan Johnson
25d1caa1ea
Added background-tasks example 2023-12-19 16:23:07 -08:00
Jonathan Johnson
27d5594776
Fixed odd padding rounding issues
The Container code was causing small rounding errors when laying out
that would cause the layout to sometimes me larger by a pixel. I
searched for all locations we are applying padding and added rounding
calls.

Refs #92
2023-12-19 15:20:02 -08:00
Jonathan Johnson
c117b1527e
Fixed integer overflow in Grid
When no space is available for the first gutter when fractional widths
are being used, there was a non-saturating subtraction that could
underflow.
2023-12-19 15:07:07 -08:00
Jonathan Johnson
a79d2f7d58
Updated Kludgine 2023-12-19 14:55:06 -08:00