Commit Graph

213 Commits

Author SHA1 Message Date
Olivier FAURE e9efc8cb18
Add RenderRoot::request_render_all method (#659)
Add a method which brute-force resets the paint and accessibility flags
for all widgets.
This is useful for rescale, and for testing purposes where you want a
quick and dirty way to repaint everything.
2024-10-09 09:59:44 +00:00
Olivier FAURE 63faaa4416
Add tests checking that pointer capture panics when used in wrong event (#652) 2024-10-09 09:57:40 +00:00
Olivier FAURE 337f7c774e
Make WidgetState private (#655)
This enforces a pattern in the codebase where that WidgetState can only
be accessed through pass contexts, which prevents invalidation bugs.
2024-10-09 09:53:59 +00:00
Olivier FAURE 1d3df8c493
Remove or split up some cruft comments (#662) 2024-10-09 09:33:57 +00:00
Olivier FAURE 0c1312563f
Add StashedChanged event (#649) 2024-10-09 09:31:59 +00:00
Olivier FAURE 801affd01e
Send synthetic PointerLeave event when pointer capture is lost (#647) 2024-10-09 09:31:48 +00:00
Olivier FAURE f6ad804ae6
Remove last mentions of hot state from code (#654) 2024-10-08 17:12:13 +00:00
Olivier FAURE c80605a2b4
Remove tracing boilerplate from widget code (#653)
Each widget implementation was doing its own bespoke tracing in layout.
This removes the bespoke tracing and adds a trace inside the layout pass
logging the same information in a more centralized way.
2024-10-08 16:34:45 +00:00
Olivier FAURE 4ace00198e
Remove html links in doc comments (#656) 2024-10-08 16:32:45 +00:00
Olivier FAURE 5da5a9257a
Add safety rail for register_children method (#635)
This gives a beginner-friendly error in cases where Masonry detects that
`register_children()` was improperly implemented.
2024-10-08 16:32:21 +00:00
Olivier FAURE 8f9583fcc6
Add doc in layout about not adding/removing children (#648) 2024-10-08 12:55:29 +00:00
Olivier FAURE f195c318e3
Rename RootWidget::get_element to RootWidget::child_mut (#645) 2024-10-07 20:10:25 +00:00
Olivier FAURE dff0990723
Remove uses of `use super` from Masonry. (#646) 2024-10-07 19:55:01 +00:00
Olivier FAURE 3809c5324a
Tweak build_access_node function (#640)
The main reason to do this is I'd like to stick to a pattern where all
the recursive pass functions call widget methods directly. I believe
this makes the code much easier to read and understand, even if you
don't consciously notice this pattern.
2024-10-07 19:28:15 +00:00
Olivier FAURE 2f105bf0da
Remove LayoutCtx::mouse_pos (#642)
That field has been made redudant by the update_pointer pass, and is no
longer used.
2024-10-07 17:52:13 +00:00
Olivier FAURE e1fb65341c
Add marker comments to passes (#641) 2024-10-07 16:46:54 +00:00
Olivier FAURE e170958eca
Add Display impl to WidgetId (#638) 2024-10-07 16:29:43 +00:00
Bruce Mitchener c899a05c13
masonry: Fix some typos. (#634) 2024-10-06 23:41:44 +00:00
Bruce Mitchener dba5f66631
masonry: `Scrollbar`: Remove unused `hovered` field (#633)
This isn't used and is just marked as dead code. It feels like a
historical artifact.
2024-10-06 23:41:28 +00:00
Olivier FAURE 165a4ac6f3
Make selection non-optional in TextWithSelection (#628)
There was no good reason for selection to be optional, except to not
display it when focus was lost. This is now handled with a boolean flag.
A side-effect of this is that TextWithSelection now remembers its
selection when focus is gained back.

Selection was used with a default value of `(0, 0)` in cases where it
was `None`, so its default value in similar cases is still `(0, 0)`.
2024-10-06 16:39:32 +00:00
Bruce Mitchener 45833e167d
masonry: Tighten or remove allowances of `dead_code` (#631) 2024-10-06 15:09:19 +00:00
Olivier FAURE 725bc0779f
Remove ROADMAP.md and move ARCHITECTURE.md (#629)
The roadmap has become obsolete, both in terms of what it tracks and of
being the living document where upcoming changes are discussed.
2024-10-06 14:00:16 +00:00
Bruce Mitchener b138910aea
masonry: Remove extraneous comment (#630)
Follow up to #624.
2024-10-05 15:15:02 +00:00
Bruce Mitchener 5213872b7e
Fix typo, update ci for typos-cli 1.25.0 (#627) 2024-10-04 03:41:09 +00:00
Bruce Mitchener 6abdce76e9
Fix `clippy::empty_line_after_doc_comments` lint (#626) 2024-10-03 16:46:42 +00:00
Olivier FAURE a04649dbc9
Rearrange text-handling code (#624)
Remove obsolete types.
Remove text_helpers module.
2024-10-03 15:05:35 +00:00
Tom Churchman 5dbafd6c86
Add public methods to access clip path (#622)
This adds public getters for clip path to non-`LayoutCtx` contexts, and
also to `WidgetState` as it seems relevant for painting.

The motivation is to remove private field accesses from
`Widget::get_child_at_pos` as mentioned in
https://github.com/linebender/xilem/pull/565#issuecomment-2374162416.

This leaves one private field access, namely `WidgetState::is_stashed`.
As per the docs of `WidgetState` ("widgets will generally not interact
with it directly"), that field perhaps should not be publicly accessible
from `WidgetState`, but then it should be accessible from `WidgetRef`.
2024-10-03 07:59:29 +00:00
Daniel McNab 1fe790ab18
Connect to tracy if the `tracy` feature is enabled (#612)
This is very useful for debugging performance issues. I've already used
it to debug [#masonry>`to_do_list`: Horrendous
performance](https://xi.zulipchat.com/#narrow/stream/317477-masonry/topic/to_do_list.3A.20Horrendous.20performance).

Setting a feature works on a workspace-wide basis. I.e `cargo run
--example mason --features tracy` works.

Some weirdness:
- Tracy seems to assume we know when a frame will "start", but we only
know if we'll repaint once processing for an event has finished.
- Something seems to be starting a default "Frame", which isn't really
right. We don't have any continuous frames. Maybe we should always
request a redraw if tracy is enabled.

Either way, I think this feature is useful to land *now*, so am not
planning on resolving these in this PR unless someone provides a
solution.
2024-10-02 12:50:51 +00:00
failingprovince fe140afc9a
feat(#574): reimplementation of `Image` widget `layout` function (#605)
Reimplement calculation of image size in `Image` widget `layout`
function.
Makes it match against `self.fill` before setting size.

Tests still missing.

Fixes #574
2024-10-02 10:08:00 +00:00
Tom Churchman c0de26f0d5
Add note about mutable child state in WidgetState::merge_up (#618)
`WidgetState::merge_up` no longer actually mutates `child_state` since
https://github.com/linebender/xilem/issues/488 and
https://github.com/linebender/xilem/pull/599, but it may do so again in
the future.

See also this Zulip thread:

https://xi.zulipchat.com/#narrow/stream/317477-masonry/topic/WidgetState.3A.3Amerge_up.20no.20longer.20needs.20mutable.20child.20state
2024-09-27 13:20:23 +00:00
Daniel McNab 7fb94561dd
Propagate the `stashed` state correctly (#613)
When the scrollbars are not being set, the calculations get NaNs. This
breaks rendering, causing extreme slowdowns and artifacts.

This is discussed in [#masonry>`to_do_list`: Horrendous
performance](https://xi.zulipchat.com/#narrow/stream/317477-masonry/topic/to_do_list.3A.20Horrendous.20performance)

I've made this work now using `is_explicitly_stashed` in layout. It does
not currently cause issues there.

The underlying issue of `NaN`s being created (and not detected) have not
been resolved.
2024-09-27 08:29:23 +00:00
Matt Campbell 997da0314b
Remove `current_node` from `AccessCtx` (#614)
It makes more sense to pass the `NodeBuilder` reference separately to
the `accessibility` method. In particular, this avoids the need to keep
calling a method on `AccessCtx` to get that mutable reference.
2024-09-26 18:13:56 +00:00
Tom Churchman 653874e103
masonry: reimplement `Widget::get_child_at_pos` (#565)
The `Widget::get_child_at_pos` has a default linear search
implementation, upholding some conditions (e.g., picking the last child
in "z-order" in case of overlap). Widgets can override this with a
custom implementation (e.g., a widget with many children that maintains
a quadtree to search through). Custom implementations should uphold the
same conditions, we can add some debug assertions to check this in a
later PR.

This introduces a `QueryCtx`, allowing widget methods access to the
global state, widget state, and widget subtree. `QueryCtx` is similar to
the other (mutable) context types, but can be shared.

This also changes `WidgetRef` to consist of a `Widget` and a `QueryCtx`,
similar to `WidgetMut` consisting of a `Widget` and `MutateCtx`. This
required changing where `WidgetRef` can be constructed.

This resolves code comment
ac95f2524a/masonry/src/widget/widget_ref.rs (L192-L199)
2024-09-26 14:37:05 +00:00
Olivier FAURE fa4eff5648
Add emit_signal method (#611)
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-09-24 17:34:43 +00:00
Olivier FAURE d4f3fc8523
Add comment about make_trace_span (#609) 2024-09-24 17:32:18 +00:00
Olivier FAURE 4ce6c338d6
Remove superfluous calls to BoxConstraint::debug_check (#610)
(The function is already called in the pass.)
2024-09-24 17:26:01 +00:00
Olivier FAURE ecc94684d5
Clean up IME handling code (#599)
Should fix the way repaints were requested every paint on some
platforms.

This PR unfortunately comes with a lack of tests. TestHarness currently
doesn't have good support for testing signals, but even if it did, this
is an inherently visual feature that we don't really have a way to test
visually.

I don't know how to trigger IME on my machine. (I'm using PopOS, a
Debian variant.) If someone wants to either test this or help me get to
speed, I'd appreciate it.
2024-09-23 17:14:45 +00:00
Olivier FAURE 37eadb58c0
Re-arrange `flex.rs` file to match format of other widgets (#600) 2024-09-23 10:56:49 +00:00
Matt Campbell 37af4b985f
Run the focus pass in post-processing for all events (#604)
Requesting and resigning focus can happen when handling pointer and
accessibility events, not just keyboard events.

---------

Co-authored-by: Olivier FAURE <couteaubleu@gmail.com>
2024-09-23 10:56:40 +00:00
Olivier FAURE 0308db26de
De-traitify text module (#515)
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-09-23 09:12:44 +00:00
Olivier FAURE 07dab9b73c
Implement stashed state (#601)
Add update_stashed pass
Add is_still_interactive method
2024-09-23 08:49:28 +00:00
Olivier FAURE 2642a9e146
Replace RouteWidgetAdded event with new register_children method (#602)
Make lifecycle method optional.
Remove InternalLifecycle.
2024-09-23 08:25:32 +00:00
Matt Campbell 12ddfa35a5
Support the AccessKit focus and blur actions (#596)
I believe this is necessary to activate and deactivate input focus with
TalkBack on Android. Assistive technologies on other platforms can also
request the focus action, though none of the AccessKit backends support
the blur action yet.

---------

Co-authored-by: Olivier FAURE <couteaubleu@gmail.com>
2024-09-19 11:52:37 +00:00
Olivier FAURE 6c91b74e97
Fix accessibility crash with stashed children (#598) 2024-09-18 14:58:15 +00:00
Daniel McNab 0d56c592f5
Add the `lens` component (#587)
See
https://xi.zulipchat.com/#narrow/stream/354396-xilem/topic/Lens.20View

Usage:
```rust
fn app_logic(state: &mut FlightPlanner) -> impl WidgetView<FlightPlanner> {
    lens(date_picker, state, |state| &mut state.date)
}

struct FlightPlanner {
    date: Date,
    available_flights: Vec<Flight>,
}
```

Also extends the docs features in Xilem Core, and increases the
complexity threshold

---------

Co-authored-by: Kaur Kuut <strom@nevermore.ee>
Co-authored-by: Philipp Mildenberger <philipp@mildenberger.me>
2024-09-18 08:10:50 +00:00
Olivier FAURE d758ae508e
Fix update_focus_chain pass (#595) 2024-09-17 15:39:19 +00:00
Olivier FAURE 7679e7c75e
Fix tab focus when no widget is currently focused (#593) 2024-09-17 08:52:59 +00:00
Olivier FAURE 09d9ad555d
Make `Textbox` focusable and trigger redraw in response to `request_layout` (#537)
Fixes #301.
2024-09-16 15:31:37 +00:00
Olivier FAURE a56d1e2467
Refactor arena code (#588)
Rewrite doc comments
Move find methods to ArenaRef/MutChildren
Create ArenaMapref/Mut in anticipation of future work.
2024-09-16 15:21:56 +00:00
Olivier FAURE 01cca4610c
Add temporary passes and remove most of lifecycle method (#589)
Add update_focus_chain pass.
Add update_new_widgets pass.
Remove RenderRoot::root_lifecycle.
Move call_widget_method_with_checks out of Widgetpod.

These new passes aren't intended to stay long-term, but are meant to
make future refactors easier and more concise.
The other goal is to remove almost all the remaining code in the
lifecycle method.
2024-09-16 12:30:41 +00:00
Olivier FAURE 4746766d89
Implement update_focus pass (#538)
Make Textbox Widget tab-focusable.

This is part of the Pass Specification RFC:
https://github.com/linebender/rfcs/pull/7
2024-09-12 11:29:21 +00:00
Olivier FAURE 2fa8a055bd
Implement update_anim pass (#539)
This is part of the Pass Specification RFC:
https://github.com/linebender/rfcs/pull/7

---------

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-09-12 11:06:33 +00:00
Jared O'Connell 3726e91a48
Grid layout (#570)
This PR adds a basic grid layout to Masonry and Xilem.

The way this layout works is it has a fixed grid based on the initial
size passed in, and grid items are placed based on the position
requested. Grid items are allowed to span more than one cell, if
requested.

There are potential improvements that could be done, like the use of
intrinsic sizing for varied column width based on content size. Though
that could be done in the future taffy layout if we want to keep this
one simple.


~~This PR is still a draft because of one remaining concern. I was not
able to successfully optimize with conditional calls to child widgets
for layout. It led to crashes about the paint rects not being within the
widget's paint rect. `Error in 'Grid' #16: paint_rect Rect { x0: 0.0,
y0: 0.0, x1: 800.0, y1: 610.0 } doesn't contain paint_rect Rect { x0:
400.5, y0: 0.0, x1: 800.5, y1: 150.0 } of child widget 'Button' #5`. My
failed attempt at fixing it is commented out.~~

Since I am rusty on View Sequences, a lot of that code is based on the
Flex implementation. Let me know if I did anything incorrectly or if any
of it is unnecessary, or if anything is missing.

---------

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-09-11 14:55:19 +00:00
Tom Churchman 9a3c8e308c
masonry: replace `set_active` and `is_active` with pointer capture (#564)
Also improve documentation of pointer capture.

Continuation of 59ee615651
(https://github.com/linebender/xilem/pull/488).

Makes `has_pointer_capture` available on all context types except
`LayoutCtx`, like `is_active` used to be.
2024-09-10 11:55:51 +00:00
Olivier FAURE dcea01a4a9
Migrate layout pass (#529) 2024-09-09 12:35:36 +00:00
Olivier FAURE 2ae73268a8
Implement update_scrolls pass (#550)
This is part of the Pass Specification RFC:
https://github.com/linebender/rfcs/pull/7

Note: This PRs comes with a lot of new TODO items. Addressing most of
these items is difficult without major refactors, because Portal code
deals with accessing values across multiple widgets, which is still hard
to do elegantly.
2024-09-09 11:28:32 +00:00
Matt Campbell 0133b6c24a
Interim accessibility for Textbox (#580)
This is just enough to allow the current content of the textbox to be
read with a screen reader, until we implement full accessibility later.
2024-09-05 20:15:51 +00:00
Matt Campbell 786ab633ba
Request accessibility update when checkbox state changes (#577)
Fixes #576

Can someone who's more familiar with Masonry please confirm that I'm
doing this the right way? I assume that one is supposed to call
request_accessibility update along with request_paint whenever the
change to the widget state could affect accessibility.
2024-09-05 12:47:53 +00:00
Daniel McNab 7be4dd2a2f
Xilem example for http cats API, requiring `worker`s and `image` component (#571)
This example is inspired by:
https://troz.net/post/2024/swiftui-mac-2024/

Current status:
- Lists status code
- Can select status code
- Downloads image from status code
- Shows image from status code

This adds two new features to Xilem:
- The worker view, which is the obvious extension to `task` for multiple
operations
- The `image` view, which just uses Masonry `Image`.

It also fixes a the Masonry Image view's layout to use the already
extant but unused method.
2024-09-03 19:02:07 +00:00
Tom Churchman 5944aa5d0b
masonry: add docs for `TreeArena::get_id_path` (#573)
beats reading the implementation to know the order :-)
2024-09-03 18:27:38 +00:00
Tom Churchman e337cf745a
masonry: fix updating Portal on scrollbar drag (#563)
Fixes scrolling `Portal` on scrollbar drag by recomposing instead of
relayouting.

Regression probably caused in 59ee615651
(https://github.com/linebender/xilem/pull/488) or
ff7635e4c2
(https://github.com/linebender/xilem/pull/522).
2024-09-02 16:14:03 +00:00
Richard Dodd (dodj) a1c7d74257
feat: add progress bar widget (#513)
@PoignardAzur I wanted to have a play with masonry, so I had a go at
building a progress bar. I've made a PR in case you want it, but I won't
be offended if you close the PR. I'm happy to make changes if you see
anything you'd like to change.

---------

Co-authored-by: Olivier FAURE <couteaubleu@gmail.com>
Co-authored-by: jaredoconnell <jared.oc321@gmail.com>
2024-08-30 21:15:34 +00:00
Daniel McNab ac95f2524a
Add the `Portal` view to Xilem (#561)
This is also added to `variable_clocks` as needed.

This could also be added to `mason`, but I see a worrying amount of lag
if I do...
I could do with some help tracking this down.
2024-08-29 05:53:50 +00:00
Daniel McNab 251f42ae87
Fix the handling of `Flex::gap` (#560)
Fixes https://github.com/linebender/xilem/issues/559

See comment on the fix for an explanation. Essentially, the `major`
value was used for multiple purposes, and this corrects into the
expected "direction".
2024-08-28 14:49:12 +00:00
Tom Churchman 923c0fb8ca
Remove manual recursion to child `paint` and `accessibility` (#557)
Recursing is done inside the paint and accessibility passes since
ff7635e4c2. I believe this is the correct
continuation of #522, with the removal of these methods "left for later"
as mentioned in
https://github.com/linebender/xilem/pull/522#issuecomment-2298610203.

One note is that Flex now debug-paints its baseline under its children,
rather than over them.
2024-08-28 13:41:36 +00:00
Muhammad Ragib Hasin 92fc669493
Enable BackgroundBrush in SizedBox view (#541)
The `SizedBox` widget in Masonry had the option to set a background
brush that was not exposed in its corresponding view in Xilem. The
`SizedBox` view now exposes the option.

Incidentally, `BackgroundBrush::PainterFn` variant had the wrong type,
as such it was not usable. A `scene` parameter is added and the closure
now requires to be `Send + Sync`.

---------

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-08-27 10:57:16 +00:00
Philipp Mildenberger 04a8e8ec74
masonry: Use `||` instead of `|` in update pass for boolean expression (#555)
Unfortunately this lint is very conservative in its detection, it hasn't
detected the other fix in this PR...
I manually checked, if we had any other bitwise or/and for booleans, and
indeed this was the only case.

---------

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-08-26 20:31:46 +00:00
Bruce Mitchener 7bd572b9a3
Fix typos. (#556) 2024-08-26 13:55:55 +00:00
Daniel McNab 4cb2552e3a
Reduce duplicated logic in `tracing_backend`, and add some docs (#530)
The calculation of the levels was previously duplicated for both web and
native, and the `WARN` level was not used properly on WASM for tests.
2024-08-26 10:24:31 +00:00
Olivier FAURE 4cddfc5157
Implement update_disabled pass (#540) 2024-08-25 13:23:38 +00:00
Olivier FAURE 414b36019b
Remove stray marker comment (#552) 2024-08-25 12:48:26 +00:00
Bruce Mitchener 991a485bd1
masonry: Re-enable `clippy::doc_markdown` (#549)
This is work towards #449.
2024-08-25 11:56:34 +00:00
Bruce Mitchener d084f0bc86
masonry: Remove 2 references to tutorials. (#546) 2024-08-25 11:43:21 +00:00
Bruce Mitchener a84791a404
masonry: Fix a dangling sentence in test comment. (#548)
Also, wrap a URL in angle brackets to satisfy `clippy::doc_markdown`
2024-08-25 11:13:54 +00:00
Olivier FAURE 3cceb60f72
Improve lints for debug prints (#551) 2024-08-25 11:10:50 +00:00
Bruce Mitchener 1d87fce293
masonry: Use `kurbo::Rect::scale_from_origin()` (#542) 2024-08-25 09:41:21 +00:00
Bruce Mitchener c1732f401e
masonry: Better markdown in comment for `check_render_snapshot` (#544) 2024-08-25 09:41:01 +00:00
Olivier FAURE 07c908a426
Remove bloom filter (#536)
The filter was only used for RouteFocusChanged which is about to be
removed. Since it was a performance feature, we can remove it early.
2024-08-25 08:51:02 +00:00
Bruce Mitchener 81b3aee40d
Don't use doc comments for VSCode markers. (#543) 2024-08-25 08:00:17 +00:00
Bruce Mitchener 62dd54b238
masonry: Add some missing backticks. (#545) 2024-08-25 07:59:53 +00:00
Daniel McNab c77c6ecb68
Disable hinting whilst a `VariableLabel` animation is ongoing (#535)
If using hinting during an animation, a shimmering effect can occur.
2024-08-23 17:34:11 +00:00
Olivier FAURE ff7635e4c2
Implement paint and accessibility passes (#522)
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-08-23 08:47:02 +00:00
Daniel McNab 455b614769
Improve tracing for use of Android GPU Inspector (#534)
- Adds tracing_android_trace
- Correct the span for VariableLabel
- Make the created apps "debuggable"
- Enable spans for `wgpu`'s `profiling` results
- Add a span around the Vello rendering to show when that is
2024-08-22 14:36:07 +00:00
Olivier FAURE bd83ed25b8
Fix Flex widget (#532)
This fixes a regression in the Mason example.
2024-08-21 14:34:36 +00:00
Olivier FAURE 7a10210e85
Fix Portal widget (#527)
One of the problems we ran into with the `to_do_list` example was that
we had a `Flex` inside a `Portal`: the `Portal` widget is designed to
display scrollbars and provide scrolling if the child is larger than its
constraints... but then Flex's `layout` method always clipped the
returned size so it wasn't ever larger than its constraints. Hence, no
scrolling. Removing the `bc.constrain(my_size)` part makes the example
have scrolling behavior again.

This PR also tweaks scrolling code and adds `#[track_caller]` attributes
to help with debugging.

---------

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-08-20 09:51:38 +00:00
Olivier FAURE 42a6a320da
Fix visual bug in masonry_calc example (#526) 2024-08-19 15:13:26 +00:00
Crockeo 522d42cf0c
masonry: add Pinch to PointerEvent (#476)
I opened https://github.com/linebender/xilem/issues/473 earlier today,
but I realized after looking at the code that it would be super simple
to implement!

Copying over some context from that issue:

- I'm working on a graph renderer using Vello.
- I'm porting it over to a Masonry widget, so that I can build a UI
around it.
- In doing so I noticed there wasn't support for winit's `PinchGesture`,
which I had been using before when messing around with this on my macOS
device.

Please let me know if y'all feel like this is appropriate to include
inside of `PointerEvent`!
2024-08-18 11:52:49 +00:00
Olivier FAURE 7842fd98df
Add per-widget trace spans to compose pass (#523) 2024-08-17 12:10:30 +00:00
Olivier FAURE 652ee68ae5
Implement compose pass (#512)
Add `Widget::compose` method.
Add `ComposeCtx` type.
Add `needs_compose`, `request_compose`, `translation_changed` flags to
WidgetState.
Add `window_origin` attribute to WidgetState.
Add convenience methods to TreeArena.
Remove `needs_window_origin` flag and `parent_window_origin` attribute.
2024-08-16 17:06:00 +00:00
Daniel McNab 3fd3903eae
Label with animated variable font parameters (#507)
This adds a new `VariableLabel` widget, which animates its weight to a
target value in a linear fashion (over a fixed time period). Also adds
support for this in Xilem, and a new `variable_clock` example. This
example also runs on Android.


[Screencast_20240812_171138.webm](https://github.com/user-attachments/assets/5df623f9-f4ca-4b55-b6a9-2047d2581b56)

Current status: The code in Xilem and Masonry library crates is final.
I'm planning on significantly updating the actual example.

Outstanding issues:

- [X] Hacks in support for "Roboto Flex", by always loading it from the
local file - resolved
- [X] It's not clear what subset of Roboto Flex we should use - still
open to bikeshedding
- [ ] The variable font animation support is not really as generic as it
should be. This starts to drift quite close to a styling question,
however.
- [ ] The only supported variable axis is `wgth`
2024-08-16 14:06:42 +00:00
Bruce Mitchener 052ac39667
masonry: Use Kurbo via Vello. (#223)
Rather than have to keep a dependency on `kurbo` at the correct version,
always use it via `vello`.

This makes this match how `peniko` is already used within `masonry`.
2024-08-16 13:53:09 +00:00
Bruce Mitchener c6c1b71640
masonry: More efficient set of PointerButtons. (#334)
This brings code over from glazier for a set of PointerButtons that just
uses a single value and bit flags rather than a `HashSet`.
2024-08-16 13:28:34 +00:00
Bruce Mitchener c380d8a2b6
masonry: Fix a couple of broken doc links. (#520) 2024-08-16 11:20:15 +00:00
Olivier FAURE cb7e9e605c
Reduce logs in tests (#511)
Stop debug log lines from showing up between test indicators when
running `cargo test`.
2024-08-15 16:41:28 +00:00
Bruce Mitchener 7607ffd13f
masonry: tweak docs: typos and linking. (#516) 2024-08-15 15:26:34 +00:00
Olivier FAURE e0d6a309d1
Implement mutate pass from pass spec RFC (#510)
This is part of the "Pass Specification" RFC:
https://github.com/linebender/rfcs/pull/7

Rename WidgetCtx to MutateCtx.
Add a mutate pass.
Add a `mutate_later` context method to trigger that pass.
Refactor `edit_root_widget` to use a version of that pass.
Add a separate constructor for the synthetic WidgetState created in
RenderRoot.

---------

Co-authored-by: Philipp Mildenberger <philipp@mildenberger.me>
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-08-14 20:06:01 +00:00
Philipp Mildenberger 0c80c0fb62
masonry: reuse redundant `ArenaRef/Mut` creation code (#509)
@PoignardAzur this is what I meant with the redundancy.
2024-08-13 12:13:11 +00:00
Olivier FAURE 59ee615651
Implement event and update_pointer passes from pass spec RFC (#488)
This is a first step in implementing the "Pass Specification" RFC:
https://github.com/linebender/rfcs/pull/7

Create a `passes` module.
Create event passes.
Create the update_pointer pass.

Remove `WidgetPod::update_hot_state` method.
Move mouse-cursor-handling code to update_pointer pass.
Implement pointer capture.
Refactor the TreeArena code.

---------

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2024-08-13 08:52:27 +00:00
Bruce Mitchener 10c064f2a1
masonry: Remove ExtEvent, Promise, WorkerCtx, WorkerFn, SpawnWorker. (#503)
These either aren't used, aren't implemented, or are just stubs. A new
implementation may or may not take the same approach given changes
within the ecosystem, and if we want these back, they're in the history.
2024-08-12 12:01:57 +00:00
Philipp Mildenberger 407c3788f0
Cleanup of unnecessary tracing and "external" `.flex()` of `num_row` in the `calc` example (#502) 2024-08-09 18:06:37 +00:00