Commit graph

291 commits

Author SHA1 Message Date
Simon Hausmann
0bf4916a5f Skia: Add support for password input fields
Fixes #2619
2023-04-25 15:26:39 +02:00
ogoffart
bd63218412 Bump version number to 1.0.1 2023-04-18 14:56:40 +00:00
Simon Hausmann
5879e1ec71 Fix touch events not working for wasm builds
Work around a winit bug for WASM builds by pinning to the exact winit
version and making the coordinates relative again.

cc #2424
2023-03-28 11:52:33 +02:00
Simon Hausmann
278d650d7d Fix error messages when supplying invalid sizes to Skia and FemtoVG
Apply the same error message as for
https://github.com/slint-ui/slint/pull/2402#discussion_r1146657846
2023-03-27 12:47:31 +02:00
Simon Hausmann
2872c13fff Fix using the software renderer with the native style
Provide access to the window inner also from within the software
renderer, so that the native style rendering can query the active state.

Fixes #2404
2023-03-24 16:29:21 +01:00
Simon Hausmann
8ffb5131c7
Introduce error handling in the FemtoVG and Skia renderers (#2402)
Avoid unwrap() and expect() and instead propagate errors all the way
down to run_event_loop(), show(), and hide() in the Slint AIP.
2023-03-24 14:18:11 +01:00
Simon Hausmann
ef07da4893 Add comment about resizing tweak on macOS 2023-03-23 15:36:42 +01:00
Simon Hausmann
c14ec0fb9c Update Skia
- This allows creating the Skia GL interface without string allocations
- Port the item renderer to use SkImageFilters::Shader instead of
  SkImageFilter::Paint
2023-03-21 09:36:39 +01:00
Tobias Hunger
3ac01c3f07 clippy: Fix clippy warnings 2023-03-09 09:35:29 +01:00
Simon Hausmann
7d984c7cb9 Skia: Improve quality of rounded rect rendering
Enable anti-aliasing, just like with FemtoVG and Qt.
2023-03-08 10:42:24 +01:00
Simon Hausmann
1473637ce3 Remove dark-light dependency on the web
winit 0.28.2 was released today, which supports `Window::theme()` on the
web.
2023-03-02 18:53:55 +01:00
Simon Hausmann
155b1443e2 Add support for reacting to dark/light mode theme changes with winit
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.
2023-02-17 16:11:44 +01:00
Simon Hausmann
59e0723793 Improved fix for panic when using OpenGL with the winit backend on Linux
Replace the patch with use of the glutin API as advised upstream (and
also implemented in glutin-winit).

Closes #2215
2023-02-09 16:16:36 +01:00
Simon Hausmann
476300ded7 Prospective fix for preview panicing on Linux v2
Avoid unwrap in the display/context selection try function.
2023-02-09 14:24:20 +01:00
Simon Hausmann
e8439061e8 Prospective fix for vscode extension preview not working on Linux
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.
2023-02-09 09:45:54 +01:00
Simon Hausmann
ed8ea3c85c Prospective fix for Linux systems that don't support EGL with X11
As the surface creation may fail with Egl later, then display preference
EglThenGlx is not sufficient and we need to completely re-do the glutin
initialization and try with GLX.

cc #2162
2023-02-03 17:12:59 +01:00
ogoffart
e7f48512ee Bump version number to 1.0.0 2023-02-03 11:07:15 +01:00
Simon Hausmann
8c807cb1da
Remove slint::Image::stride() (#2147)
cc #2138
2023-01-30 13:59:31 +01:00
Simon Hausmann
52fb1ab9fe Fix signature of get_proc_address in Rust GraphicsAPI
Use a CStr instead of str, to avoid an extra CString allocation. The underlying operating system API for
this expects a zero terminated C String.

Fixes #1943
2023-01-26 11:55:10 +01:00
Simon Hausmann
d5ca021485 janitor: Update glow dependency 2023-01-24 09:35:18 +01:00
Simon Hausmann
5ff0278185 Simplify path event extraction
Return the path events for rendering as an Option, so that if the path is empty,
we simply return.

This avoids a double property dependency in the (likely) event the path is not empty.
2023-01-21 13:10:19 +01:00
Olivier Goffart
d6b66a0690 Skia/femtfovg rectangle with transluscent border: set minimum radius
Set the minimum radius of the background to limit the artifact when
drawing the border
2023-01-20 14:12:43 +01:00
Simon Hausmann
b2c0392d7d
Fix Skia's drawing of the border rectangle with non-opaque borders (#2079) (#2086)
Also fix the border radius to be the outer radius of the rectangle

Skia renderer part of #1988 (minus clipping)
2023-01-20 11:33:55 +01:00
Simon Hausmann
0d23478469 skia: Cache and re-use Skia path elements for Slint item paths
This follows Skia best practices to re-use the path, because internally each path has its own id
that is used by the backend to cache stuff.
2023-01-16 21:31:10 +01:00
Simon Hausmann
5ebab4b354 skia: Fix wrong path offset
Convert from logical to physical pixels for the offset.
2023-01-16 21:31:10 +01:00
Olivier Goffart
00de1867ae Janitor: deps upgrade 2023-01-16 10:47:55 +01:00
Simon Hausmann
0d37565cc2 janitor: bump Rust Skia bindings to the latest release
This includes additional cross-compilation build fixes that will allow
removing patches from the Yocto recipes.
2023-01-16 10:12:52 +01:00
Simon Hausmann
a124f4b8fe Fix opengl underlay example not running with Skia OpenGL renderer
Commit 01d2efce4e ended up creating our
OpenGLSurface type with the GL context not current, and right after that
SkiaRenderer would invoke the RenderingSetup callback, which expects a
current context.

Solve this by simplifying the context handling in the OpenGLSurface in
the Skia renderer: The main purpose of glutin's NotCurrentContext
appears to be the ability to send it across threads, which we don't
need. Therefore always store a PossiblyCurrent and use the context's own
interior mutability to make it current if needed.
2022-12-21 11:53:59 +01:00
Olivier Goffart
5cd38adb14 Move the colorize property to the Image item
Instead of the ClippedImage. Because we use the colorize property more
often than the source property, and these are soon going to be even more
expensive
2022-12-20 08:42:47 -08:00
ogoffart
ce07d078ce Bump version number to 0.3.4 2022-12-16 09:36:15 +00:00
Simon Hausmann
aea216fb49 Fix rendering of border widths with FemtoVG and Skia
Commit f66a2a5775 and dc048a11db introduced
the regression of issue #1985 where in adjust_rect_and_border_for_inner_drawing
instead of subtracting the entire border width from the size,
only half of it was subtracted,
leaving an inner area of the rectangle visible.

Fixes #1985
2022-12-14 15:32:53 +01:00
Olivier Goffart
ef137de886 Janitor: fix build of skia backend on windows
We're missing a feature, which is enabled when building with winit, but
not when winit is not enabled
2022-12-12 17:10:02 +01:00
Olivier Goffart
b8b892a91d Janitor: upgrade skia 2022-12-12 15:32:36 +01:00
Simon Hausmann
cffe997aa9 Fix build of Skia renderer with default features on Linux
Whether or not we need glow depends on the decision made in build.rs,
which means in Cargo.toml we can't opt out.
2022-12-12 13:47:47 +01:00
Simon Hausmann
a4e4863669 Fix SkiaRenderer::new to take the window adapter weak by value
... for consistency with the software renderer API.
2022-12-12 12:01:12 +01:00
Simon Hausmann
7b4a3cd29a Improve the safety of the skia renderer API
Claim a strong reference (ownership or RC) on the value that provides the raw window handle.
2022-12-12 11:59:50 +01:00
Simon Hausmann
47cb989258 Add some barebones docs 2022-12-09 17:04:54 +01:00
Simon Hausmann
43498f05b9 Make Surface trait internal 2022-12-09 17:04:54 +01:00
Simon Hausmann
fcde60d1d6 Add boilerplate README for internality of the crate (for now) 2022-12-09 17:04:54 +01:00
Simon Hausmann
1fcdf6c28c Add license symlinks 2022-12-09 17:04:54 +01:00
Simon Hausmann
01d2efce4e Move the Skia renderer into a separate crate
The crate is an internal crate until the API has been polished and
documented, after which we can call slint-renderer-skia for example.

This also duplicates a little bit of the glutin setup code, because
that would otherwise have to go into another shared crate.
2022-12-09 17:04:54 +01:00