~gioverse/chat

list: fix idle modification test

The idle modification test was failing because the data
inserted sorted to the end of the list while that direction
was not being ignored. This made the data get discarded.

There were two ways to fix this:

1. Ensure the Comparator hook never indicated that
the data sorted to the end of the list.
2. Trigger load requests to ensure that the async logic
realized that it was at the end of the list.

I chose to implement the first option here, though
the other should also work.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
list: queue state updates

This protects the assumption that list managers can be
used even while idle (not currently being laid out) by
queueing the state updates until the next change to lay
out.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
deps: update gio

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
list: [fix] copy state update slice to avoid data race

I observed a data race between layout and the process goroutine that
appears to be a result of sharing the element slice.

While querying for which serials are in the viewport during layout, the
async process was updating those same elements during a modify request.

After reviewing the code I concluded that the slice was being shared and
should rather be copied before reaching layout - that is, before being
sent over the updates channel.

After applying this change, I could not reproduce the race condition.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
async: [fix] respect max loaded worker count

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
async: limit workers on FixedWorkerPool

I thought I had fixed this, but it turns out I had only
limited one of the worker pools!

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
widget/material: maintain size for empty images

If the image source is empty, we should maintain the specified size so
that the parent can rely on the Width and Height values they specified.

Prior to this patch, the layout would move around when the image was
empty one frame and present the next. This produces bad user experience
as the layout resizes as images pop in.

Such behaviour reliably occured when using an async.Loader to download
images.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
example/carousel: adapt to new Loader signature

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
example/kitchen: update to new Loader signature

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
list: update Loader to return if more elements

This commit changes the signature of the Loader hook so that it
also returns whether there are more elements in a given direction.
This greatly simplifies some of the state management logic, and
actually eliminates several spurious invocations of the Loader
hook.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
list: add field indicating type of state update

This commit adds a field describing what triggered a given state
update.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
list: expose Stickiness field on Manager

The new list.Manager.Stickiness field gives explicit control
over which list ends (if any) are "sticky" when the scroll
position reaches them. A "sticky" end means that the viewport
will remain attached to that end when new content is inserted
there unless the user scrolls away from that end of the list.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
list: export and document additional list.Directions

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
debug: add function to trace code paths

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
debug: add function to easily log structures

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
list: hotfix ignore direction

Fixes two silent failures:

1. list.Manager was not actually capturing the ignore direction, so it
never stopped the load requests from being sent.

2. the stateful nature of ignore direction requires both Add and Contains
to be called on a persistent stateful variable. Calling them on the
load request itself is meaningless because that value is thrown out per
iteration.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
list: make Manager respect List.ScrollToEnd

This commit adds support for sticking to the end of
the list content across asynchronous insertions of data.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
list: ensure async goroutine is shut down by GC

This commit ensures that when a list.Manager falls out of use,
the asynchronous goroutine that it spawns in its constructor
is also shut down.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
widget: consistent receiver name

Satisfy linter by using a consistent receiver name.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
widget: allow method chaining

It's common to use this type to cache and then immediately use.
Chaining would allow this to occur on a single line:

    picture.Cache(img).Op()

Rather than forcing a multi line approach:

    picture.Cache(img)
    picture.Op()

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Next