I misread the spec about the name conversion for the DOMStringMap used in JS for the dataset
attribute and the name used in the DOM.
Both, the setting in preview_widget.ts as well as
reading it in windowadapter.rs counts as JavaScript access, so use camel case.
The old variant happened to work in Safari.
Amends 43234dafc5
When for example only a maximum height is set, but no maximum width,
avoid passing -1 or 0 to winit for the width. Instead use the same large
value was for Qt.
cc #2562
When the dark color scheme was queried before the window was mapped, we'd initialize it to false,
but never update it to the actual theme value.
Fixes#2533
Add a data attribute hack to force auto-resizing to the preferred size
in SlintPad. Otherwise the initial size of the hello world will remain
in effect when loading other demos.
Since winit can't handle resize from the CSS or JS, work it around in
the demo by calling set_size on the slint window.
Also fix slint_size panicking not working on wasm as the map_state was
mutably borrowed by the set_size, and this may recurse into other
functions (eg, draw) causing a panic. So don't keep the state borrowed
when calling winit.
Another fix is fixing the initialization size of the window item when
the initial size is set with set_size
Fixes#547
Remove the dark-light dependency, as it significantly slows down the
build on Linux. On Windows/Mac/Web it's not needed. On Linux Desktop,
folks are likely going to have Qt installed - where this works - and on
Embedded Linux the assumption is that it's not running as Linux Desktop.
On Linux the number of dependencies for `-p slint` goes down from 418 to
328. Build time on my machine goes from 1 minute down to ~50 seconds.
Winit defaults to sctk-adwaita with ab_glyph rendering. Pick the same
default when the wayland feature is enabled on our end.
This is a stop-gap. In the future we should try to implement the window
decoration rendering ourselves.
Fixes#2188
In order for GLX support to work, we need to create the X11 window with
the same visual as in the GLX configuration. That requires delaying
the creation of the window.
This is done in four parts:
- The window builder is re-introduced in the winit backend create
internal renderer interface.
- The glcontext helper code for wasm was moved into a separate function
(less indentation).
- The loop over different display preferences was replaced with a
preference to the "window system native GL interface" over EGL,
which should achieve the same as the fix for #2162. Upstream glutin
defaults to this and so do various downstream projects.
- Use glutin-winit for the actual display selection.
This covers the FemtoVG bits of #2269
Fix the code to always return a direct child widget or nullptr. The
documentation says to return a direct or indirect child, but the
implementation expects a direct child.
Fixes: #2195
We should only forward keys that are a single character. Other ones are
just virtual keys that should't be processed.
This regressed in commit 32d2ba7Fix#2327
This will be needed for a future experiment. Unlike the Skia renderer,
which operates on raw window handles, the FemtoVG renderer exposes a
different interface where it assumes that the caller takes care of the
OpenGL context state. This means more boilerplate remains in the winit
backend, including the glutin dependency. The upside is that it will
allow using the FemtoVG renderer in environments without glutin.
In order to work in an environment without fontconfig or memmap, the
crate has two features:
- fontconfig (set when we anticipate fontconfig to be available at
run-time and libloading being available at compile time).
- diskfonts (set when we want to be able to load fonts from disk)
The winit crate enables fontconfig on "Linux" and diskfonts on !wasm.
This is reproducible in the energy monitor when scrolling down in the
settings page.
In the helper function to colorize an image, we did not expect
brush_to_paint() to fail. The condition of a transparent colorize color
was handled earlier, but it turns out that brush_to_paint() also checked
the global state as an optimization.
This optimization is wrong, as the cached colorized image should not
depend on the untracked global transparency.
So this patch adds a graceful handling of brush_to_paint returning None
for defensive measures, but also moves the early return on an global
transparent alpha to the call sites where it makes sense.
On macOS and Windows, use winit's `Window::theme()` instead of
dark-light, to detect the theme.
Always react to WindowEvent::ThemeChange. It's delivered on macOS,
Windows, and the web.
The CI build vsix panics on line 84 in glcontext.rs. There's no unwrap()
there but there's one nearby. I wasn't able to reproduce this with a
local build, so this is a prospective attempt, assuming that this is due
to the attempt of glx-over-egl display configuration finding.
Having a const generic for that didn't turn to be a good API.
Also made the C++ side more difficult
(Also renamed buffer_stride to pixel_stride)
Closes#2135