Commit graph

7044 commits

Author SHA1 Message Date
Simon Hausmann
ea94089b05 Provide an error enum for the error case of slint::platform::set_platform
cc #1502
2022-09-06 15:42:16 +02:00
Olivier Goffart
594131a7ea winit: Enforce the min/max size in the WindowBuilder and set size again for wasm
In previous version, we were setting the constraint with wasm after
the window was shown, but this is no longer the case because we delay
the window creation by an iteration of the event loop.
Now should apply the constraint before showing the window.

But on wasm, we also must manually enforce these constraint because the
size given to the WindowBuilder is not applied
2022-09-06 14:23:58 +02:00
Olivier Goffart
24244e3c7c janitor: Rename a variable 2022-09-06 13:43:52 +02:00
ogoffart
05a49da906 Bump version number to 0.3.0 2022-09-06 13:00:22 +02:00
Olivier Goffart
2760d96b79 Make VecModel::remove() return the removed value like Vec
Fixes #1221
2022-09-06 05:42:56 +02:00
Olivier Goffart
40f489041e Rename slint::internal to slint::unstable_private_api and move re_exports into it
Also move the module in its own file
2022-09-06 05:42:11 +02:00
Simon Hausmann
90ba9ffa17 Fix "glyph box" in AboutSlint when rendered on MCU
The AboutSlint text has a forced linebreak in it, which becomes a box
glyph on MCUs when the font on the host system doesn't use an empty
glyph but a box glyph for \n.

This patch explicitly excludes glyph clusters from text fragments that
feed into lines that originate from one of the three valid separators:
ascii newline, unicode paragraph and unicode line separators.
2022-09-05 21:42:26 +02:00
Olivier Goffart
f715a0c214 Try to fix the way the window is resized
- We must first set change the constraints before changing the size
   otherwise the new size might not be in the old constraint and the
   change might not take effect.

 - We must update the WindowItem's size even if the size of the window
   doesn't change. This happens when a component is set on a window that
   that doesn't change it size (eg, preview) but for which we need to
   set the geometry on the window
2022-09-05 16:19:27 +02:00
Simon Hausmann
5fe212f459 Make sure that skia_backend_opengl is always set on Linux 2022-09-05 14:07:27 +02:00
Simon Hausmann
3a1817de3f Skia: Make it possible to explicitly select the OpenGL backend of Skia
When opting into the Skia renderer, we default to metal on macOS and D3D on Windows.
However if you want to develop a cross-platform application with Skia and
for example rely on OpenGL to be able to implement an OpenGL underlay or overlay,
then we need the ability to explicitly opt into skia's GL renderer.

cc #1445
2022-09-05 14:07:27 +02:00
Simon Hausmann
3ebdb1b86d Add debug info about the Skia back buffer color depths
Include the number of bits per pixel in the existing output
2022-09-05 13:53:04 +02:00
Olivier Goffart
8ebcfd81b8 Gallery example: move the checkbox on another line 2022-09-05 13:08:27 +02:00
Simon Hausmann
7323e0b93d Bump Skia version to 0.54
This release upgrades to Skia milestone 105 and  includes binaries for
the new windows-textlayout-d3d-opengl configuration that is available as
opt-in.
2022-09-05 11:27:30 +02:00
Olivier Goffart
0085145d10 MCU documentation 2022-09-04 18:31:26 +02:00
Olivier Goffart
9a2b1c7b6b Don't export PLATFORM_INSTANCE in the public API
Use a hidden internal helper function instead
2022-09-03 11:45:54 +02:00
Olivier Goffart
d4df55e6ab Move non-backend features outside of the backend section 2022-09-03 11:15:26 +02:00
Olivier Goffart
ec19ef77f1 platform: don't re-export types that are no longer needed 2022-09-03 11:11:43 +02:00
Simon Hausmann
f648f152f9 Improve debug_log interface in the Platform
Pass Arguments and let the caller decide how/when to convert to a string.
2022-09-02 20:13:41 +02:00
Simon Hausmann
cde6cc2110 Simplify debug_log macro 2022-09-02 20:13:41 +02:00
Simon Hausmann
437218db70 Replace the built-in defmt debug logging to the platform trait
This way we don't have to add defmt, esp32-println and others as features to corelib and the slint api crate
(which would also expose them as public dependencies),
but instead this can be simply delegated to the Platform trait.
2022-09-02 20:13:41 +02:00
Tobias Hunger
deee971b76 Implement suggestions from @ogoffart 2022-09-02 17:48:31 +02:00
Tobias Hunger
606670e919 LSP: Return iterators instead of passing in a Vec for the result value 2022-09-02 17:48:31 +02:00
Tobias Hunger
75b02530a9 LSP: Add tests for element_at_position and get_properties 2022-09-02 17:48:31 +02:00
Tobias Hunger
521a4001dc Fix some clippy warnings 2022-09-02 17:48:31 +02:00
Tobias Hunger
7eab597b48 Update tools/lsp/server_loop.rs
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2022-09-02 17:48:31 +02:00
Tobias Hunger
163f85a6f7 LSP: Implement a queryProperties command
Implment a command in the LSP that can be used to query all known
properties, where those are declared and defined.

With this information we should be able to provide an property editor in
IDEs.
2022-09-02 17:48:31 +02:00
Olivier Goffart
3f1324cc61 Allow to run the software backend without the femtovg backend 2022-09-02 16:38:35 +02:00
Simon Hausmann
721d530cff
Improve appearance of default code snippet in the online editor
Center the items horizontally and avoid an over-sized button.
2022-09-02 15:09:51 +02:00
Olivier Goffart
ab5fcfd234
Update link in the printerdemo_mcu README 2022-09-02 14:12:36 +02:00
Olivier Goffart
ed8fba7041 Add license header to make reuse happy 2022-09-02 11:57:27 +02:00
Olivier Goffart
7d3c47cff2 esp32: implement duration_since_start 2022-09-02 11:57:27 +02:00
Olivier Goffart
f1964e75bd WIP: initial support of the ESP32-S2-Kaluga-1 2022-09-02 11:57:27 +02:00
Simon Hausmann
7e5de3d5d3 Remove use of euclid types and tags for logical/physical position and size in the public API
Instead provide our own types.
2022-09-02 11:05:53 +02:00
Simon Hausmann
85461d380d Remove euclid from the public re-export of the Slint crate 2022-09-02 11:05:53 +02:00
Tobias Hunger
dc87b076a1 lsp: Report our name based on crate configuration 2022-09-01 15:57:28 +02:00
Tobias Hunger
ad33c257cf lsp: Use InitializeResult from lsp-types
Make the previous patch typesafe by enabling the "proposed" feature in
the `lsp-types` crate, so that the `InitializeResult` has the
`offsetEncoding` field.

Fix the fallout of this change.
2022-09-01 15:57:28 +02:00
Tobias Hunger
051cf83482 lsp: Improve LS initialization responses
Make the LS respond with this data:

```lua
{
    capabilities = { ... server_capabilities ... },
    offsetEncoding = "utf-8",
    serverInfo = {
        name = "slint-lsp",
        version = "0.2.6"
    }
}
```

This forces `characters` in the protocol to be byte-offsets into utf-8 encoded
strings and provides some information about this server that is nice to
have.
2022-09-01 15:57:28 +02:00
Olivier Goffart
9f5106eef1 Janitor: update notify dependency 2022-09-01 15:39:04 +02:00
Olivier Goffart
fb7b725182 Upgrade to rp-pico 0.5
Which implies changing from embedded_time to fugit
2022-09-01 14:19:52 +02:00
Olivier Goffart
5900ec3373 Janitor: update corrosion 2022-09-01 14:03:46 +02:00
Olivier Goffart
e0f1fdf298 Rgb565Pixel: remove color accessor, add conversion to Rgb8Pixel
Closes #1540

(Went or Rgb8Pixel instead of color, because color can have alpha)
2022-09-01 13:58:38 +02:00
Olivier Goffart
a647fe2d74 Rgb656Pixel: Mask the shifted value to prevent overflow in the addition 2022-09-01 13:58:38 +02:00
Olivier Goffart
fc0da0fc25 Ci: fix the build_docs.yaml
Forgot that the CI didn't run the test before it is in the master branch
2022-09-01 12:56:37 +02:00
Olivier Goffart
1237285fef Fixup some documentaion links
And add a test in the CI that checks for warnings in the internal
crates

(Also changed --exlcude in the test to be matching the one from build,
since c++ test are tested separately)
2022-09-01 12:16:24 +02:00
Olivier Goffart
fcca38e0f6 Rename set_event_loop_quit_on_last_window_closed to remove EventLoopQuitBehavior
For the winit backend, also make the function work after a call to run()
2022-09-01 12:08:05 +02:00
Simon Hausmann
a7121a6177 Remove erroneous mention of SLINT_FEATURE_EVENTLOOP_WINIT_ALL
We used to have SLINT_FEATURE_BACKEND_GL_ALL, but when we introduced the
renderer and event loop distinction in the features, we removed the "all" suffix from
the event loop that includes x11 and wayland support.
2022-09-01 11:25:49 +02:00
Simon Hausmann
581bd04253 Fix build without std and no additional debug output support
Do nothing then
2022-09-01 09:19:22 +02:00
Simon Hausmann
d57a26276f
Fix typo
Spotted by @BartBM
2022-08-31 21:21:27 +02:00
Tobias Hunger
11c5fc29aa lsp: Add some basic tests 2022-08-31 17:10:51 +02:00
Simon Hausmann
c1dbf47d15 Fix appearance of drop shadows with Skia
Similar to commit 957186acb7 we need to take the blur into account in the box shadow image:

We add blur margins around the entire image, but we also need to start drawing at (blur, blur) instead of (0, 0).
The same offset needs to be subtracted again when drawing the cached image.
2022-08-31 11:36:04 +02:00