Very hard to intentionally reproduce, thankfully the second time I saw
it I was in the debugger and was able to reason about the code path that
could have gotten in that particular state. Comment explains the actual
situation.
On some platforms, notably Wayland, the window immediately responds to
resize requests. This means that if the window resizes itself during the
prepare operation, the current graphics context is no longer the correct
size for the window. Before this change, Kludgine was working around
this by noticing the discrepency and forcing an extra refresh. This
workaround is still in place in Kludgine, but now Cushy supports
restarting redrawing upon resize.
Due to complexities in input routing and how that interacts with layers,
it seemed prudent to support installing shortcuts directly on the
window.
This also enables overriding default shortcuts like Primary+W to close
the window.
These aren't entries in the changelog since they're bug fixes for new
code since the last release -- the entries on the changelog are
unaffected.
- focused and occluded no longer is explicitly set to false. Now, once
the window has been fully initialized, the values are read from winit
which will cause callbacks to be fired if the value has changed.
- The automatic_layout parameter if outer_position had its meaning
inverted. Passing true now properly ensures the window is
automatically positioned.
- synchronize_platform_window is now called prior to the first redraw.
This allows the `visible` attribute to be changed from false to true.
- Some window attributes are automatically set based on the incoming
dynamic.
- Some initial window values are delayed until after the first layout to
minimze "noisy" values.
All of these changes now allow a window that is resize_to_fit to be
initially hidden and show itself centered after being initially resized
without any flashing or on-screen movement/resizing.
map_each previously was written such that if a chain of mappings fed
each other, a deadlock could occur because while the first one was
mapped, the second callback gets invoked and tries to update the first
value while it's still being held.
This refactor switches from std Mutex to parking_lot, allowing me to
remove a workaround for needing to run drop callbacks in a separate
thread during the drop of a DynamicGuard.
In addition to that change, the lower level `map_generational` calls now
take a DynamicGuard as their parameter. This allows these functions to
drop ownership of the referenced data during the callback.
The map_each implementation takes advantage of this by ensuring that the
guard is dropped before set is invoked, minimizing potential lock overlaps.
With this refactor, some old code of mine with complex validations now works
again.
I originally removed this API to ensure no Cushy widgets were using
winit directly, but I've reintroduced it so that third party widgets can
still interact with winit if needed.