Commit graph

272 commits

Author SHA1 Message Date
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
Jonathan Johnson
ecca658375
Merge branch 'reactive-inner-size' 2023-12-19 14:20:18 -08:00
Jonathan Johnson
873e6d6f16
Added inner_size syncing
This adds upon the work in #94 by allowing the dynamic's value to be set
and it cause the window size to change.

I've ordered the resizing operations so that changes to the property are
prioritized over automatic adjustments. This doesn't change the behavior
for automatic adjustments in any way.
2023-12-19 13:33:45 -08:00
Jonathan Johnson
4959296e07
Fixed callback invocation from multiple threads
Closes #97

There was a potential race condition described in #97 that I realized I
had seen occasionally when interacting with an element that was
currently being animated. These were in complex situations, so I thought
I had a situation that could have legitimately caused the warning.

However, this warning is preventing a very specific coding "error", and
that program did not have it. The existing implementation would
potentially prevent one thread's change from invoking its callbacks
because another thread was already executing its callbacks.

This change moves that state into a Mutex/Condvar pair that allows
detecting reentry while allowing other threads to block until its their
turn. When it becomes their turn, they can check whether the callbacks
were invoked with the current value or not to prevent callbacks from
being invoked in quick succeession with the same value by multiple
threads.
2023-12-19 11:41:21 -08:00
Marli Frost
f9d0203ff5 Add API for tracking checked to the inner_size of a window
This matched the apis used for focused and occluded
properties. I've added an example to demonstrate usage.
2023-12-19 13:51:28 +00:00
Jonathan Johnson
63fd92eea6
Added changelog 2023-12-18 20:14:01 -08:00
Jonathan Johnson
75eb96b5f5
Preparing v0.1.2 2023-12-18 17:15:21 -08:00
Jonathan Johnson
a1e3082527
Fixing compilation on Windows
Condvar isn't UnwindSafe on Windows either. See
rust-lang/rust#118009
2023-12-18 17:10:04 -08:00
Jonathan Johnson
7dc00f27e0
Fixing links in readme
I somehow lost my variables at some point.
2023-12-18 11:40:45 -08:00