Commit graph

871 commits

Author SHA1 Message Date
ogoffart
261614b914 Bump version number to 0.3.1 2022-09-15 14:39:51 +02:00
Olivier Goffart
419016a356 Rename the compat feature again
crates.io won't let us upload a feature with dots in it:

```
Uploading slint-interpreter v0.3.0 (/home/olivier/slint/internal/interpreter)
error: failed to publish to registry at https://crates.io

Caused by:
  the remote server responded with an error: invalid upload request: invalid value: string "compat-0.3.0", expected a valid feature name at line 1 column 2254
```
2022-09-14 15:55:57 +02:00
Simon Hausmann
8556ad0864 Refer to the release/0.3 branch instead of release/0.2 for the CMake docs 2022-09-14 15:45:16 +02:00
Tobias Hunger
e14fae45cd c++: Turn (Logical|Physical)(Size|Position)` into structs
They used to declared by `using` before, so they were too easy to
convert into.
2022-09-13 18:17:56 +02:00
Tobias Hunger
53a3c72b57
api: Change logical/physical position and size on window (#1620)
* Add `RequestedSize` and `RequestedPosition` enum to enable asking for
  logical or physical size/position.
* Rename `Window::size()` to `Window::physical_size()`
* Make `Window::set_size(...)` take an `Into<RequestedSize>`
* Rename `Window::position()` to `Window::physical_position()`
* Make `Window::set_position(...)` take an `Into<RequestedPosition>`
* Change `WindowAdapter` and related classes to be able to handle
  requests being made in the either physical or logical units.

Implement this for C++, Rust and node.
2022-09-13 08:55:31 +02:00
Simon Hausmann
012dc34975 Remove the Rust and C++ migration guides from the documentation 2022-09-09 16:53:49 +02:00
Olivier Goffart
8850959a2c Rename the backend feature flags 2022-09-07 17:11:57 +02:00
Olivier Goffart
15fa69ef55 Rename the compat-0-2-0 feature to compat-0.3.0
But keep a compat-0-2-0 fome compatibility anyway
2022-09-07 14:09:07 +02:00
Olivier Goffart
6ede77436b api: Return an error from invoke_from_event_loop and quit_event_loop 2022-09-07 10:13:58 +02:00
ogoffart
05a49da906 Bump version number to 0.3.0 2022-09-06 13:00:22 +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
Olivier Goffart
5900ec3373 Janitor: update corrosion 2022-09-01 14:03:46 +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
Tobias Hunger
3430a13bf8 API cleanup: Remove quit behavior parameter from run_event_loop 2022-08-30 08:34:45 +02:00
Tobias Hunger
10c3c9d16d Api cleanup: Rename some remaining platform abstractions to platform 2022-08-29 16:53:47 +02:00
Tobias Hunger
88cf874d03 API cleanup: Rename create_window to create_window_adapter 2022-08-29 16:53:47 +02:00
Tobias Hunger
1e6ffeaa0f API cleanup: Rename PlatformWindow to WindowAdapter 2022-08-29 16:53:47 +02:00
Olivier Goffart
7417422e3c Make the PlatformAbstraction not Send using a EventLoopProxy trait
This changes the way the platform abstraction is initialized
2022-08-24 11:32:21 +02:00
Olivier Goffart
2e5ab86bea Rename backend module to platform
and the Backend trait into PlatfromAbstraction trait
2022-08-23 19:39:49 +02:00
Simon Hausmann
c69437fe8f Fix build of CMake package inside Yocto build
When building against a Yocto SDK, CFLAGS isn't set, only CC. When
building inside Yocto, CC is set to just the target compiler and CFLAGS
contains the target specific options. Just like with commit
5bc56a3924 we need to cover also
HOST_CFLAGS by making them empty.
2022-08-19 17:02:30 +02:00
Simon Hausmann
1d436778c1 Remove the use of the PlatformWindowRc alias again
and use Rc<dyn PlatformWindow> instead. The alias has to stay with the ffi
functions though and the item vtable definitions,
because we don't have an Rc<> template in C++.
2022-08-19 15:07:27 +02:00
Simon Hausmann
98e1befd0d Port the C++ generator and C++ API to the new window ownership model
One key difference to the Rust way is what `slint::Window` means. In
Rust that holds the `WindowInner` and `slint::Window` is only exposed as
`&slint::Window`. This is possible because the component owns the
`Rc<dyn PlatformWindow>`, which has a function to return the
`&slint::Window`.

In C++ `slint::Window` is also exposed as `slint::Window&` in the
`window()` getter, but there's no way to get a reference to a  C++
wrapper for the Rust `&slint::Window` that the `PlatformWindow` trait
returns. Therefore in C++ `slint::Window` wraps `Rc<dyn
PlatformWindow>`.
2022-08-19 15:07:27 +02:00
Simon Hausmann
af86f36157 Invert slint:🪟:WindowInner and PlatformWindow ownership
Previously: Window is an Rc<WindowInner>, which has an Rc<dyn
PLatformWindow> - and weak references the other way around.

Now: Rc<dyn PlatformWindow> is the root of window ownership. The impl
PlatformWindow has a slint::api::Window, which just holds a WindowInner.

This change is incomplete on a few levels, mainly that neither of the
code generators nor the interpreter is ported.
2022-08-19 15:07:27 +02:00
Olivier Goffart
ca6dfc0cb5 Run clang-format over C++ files 2022-08-17 07:44:22 +02:00
Simon Hausmann
5bc56a3924 Fix Skia cross-build when using CMake
This requires a creative workaround :-)
2022-08-04 16:41:26 +02:00
Simon Hausmann
771b122198 Add skia renderer skeleton
This one can render basically just plain rectangles.
2022-08-02 12:00:56 +02:00
Simon Hausmann
70a753756d Fix cmake compat options
Use option() directly, not propagate that into the cpp crate
2022-07-26 17:43:51 +02:00
Simon Hausmann
b47eb8507a Remove the rtti-winit and rtti-qt features
These are not needed anymore, as the selector can enable the respective rtti features
in the winit and gl crate when its own rtti features is enabled.
2022-07-26 17:43:51 +02:00
Simon Hausmann
3619989fcc Rename backend feature flags to accomodate more renderers
Split backend-gl-* into eventloop-winit-* and renderer-femtovg.

The old feature names are still available.

For consistency eventloop-qt and renderer-qt are aliases for backend-qt.
2022-07-26 17:43:51 +02:00
Simon Hausmann
27bf9348e6 Rename the backend-gl crate into backend-winit 2022-07-26 17:43:51 +02:00
Olivier Goffart
8c70cd7f57
Move the fonts out of the Backend trait (#1438)
and remove the `'static`
2022-07-26 16:45:54 +02:00
Simon Hausmann
fe3d4b7177 Bump MSRV to 1.60 2022-07-26 09:20:52 +02:00
Olivier Goffart
8287ed4b9e Some more simplifications of the PlatformWindow and Backend trait 2022-07-25 14:51:03 +02:00
Olivier Goffart
0c7ad1aa41 Unpin the markdown dep
Because https://github.com/ryanfox/sphinx-markdown-tables/issues/36 was
fixed, and now the workaround is actually causing an error
2022-07-25 12:03:43 +02:00
Olivier Goffart
ac4f3e97ad Change slint enum values to be PascalCase in rust
... while still being kebab-case in .slint

Some enums might become public API and we want to have them as
PascalCase to respect the rust conventions
2022-07-22 12:23:52 +02:00
Olivier Goffart
c28c527e0e Split the properties.rs files in modules 2022-07-21 14:07:15 +02:00
Simon Hausmann
34dc0a80e7 Fix duplicated images when building with embedded images
For embedded images the path is empty but we unconditionally used it to create a TextureCacheKey,
which clashes.

Instead, preserve and store the ImageCacheKey in the ImageInner variants.
2022-07-20 12:57:37 +02:00
Olivier Goffart
65346c699c Attempt to get the "image-in-corelib" feature compile with C++ 2022-07-20 12:57:37 +02:00
Simon Hausmann
67a2f0ce3f WIP: Make image decoding a feature of the core library
This includes the cache of decoded images, the HTMLImage element support
and the SVG rendering adapter.

The objective is that Image holds an ImageInner, which is not a path
anymore that the backend has to process, but instead always either
decoded image data, a pointer to a static texture or an SVG tree that
can be rendered to the desired size.
2022-07-20 12:57:37 +02:00
Olivier Goffart
29d28dc73e C++: don't force the SLINT_STYLE cmake variable
Keep the default if unset, otherwise use whatever SLINT_STYLE was passed
2022-07-20 12:18:18 +02:00
Olivier Goffart
dd5adebcdc C++ docs: pin the markdown version to fix build error in CI:
```
Extension error (sphinx_markdown_tables):
    Handler <function process_tables at 0x7fcce7e1dc10> for event 'source-read' threw an exception (exception: __init__() missing 1 required positional argument: 'config')
```
2022-07-18 15:51:14 +02:00
Olivier Goffart
ec483e500e Pin all pythin depeds in order to attempt to fix the C++ docs 2022-07-18 15:24:58 +02:00
Simon Hausmann
0b118577da
Pin markdown tables extension
There was an api change, so pin to the previous version for now.

Prospective fix for nightly build failure.

We should probably pin all dependencies (at least semver style) - it’s a miracle this hasn’t broken earlier :)
2022-07-16 09:30:37 +02:00
Simon Hausmann
8d3bb877b7 Use euclid::Point2D also for the getter, but with out parameter instead of return value 2022-07-08 18:37:01 +02:00
Simon Hausmann
d6f8048232 Use Point2D in the C++ ffi when setting the window position 2022-07-08 18:37:01 +02:00
Simon Hausmann
937c37677e Add API for setting and getting the size of a Window in Rust and C++ 2022-07-08 18:37:01 +02:00
Simon Hausmann
372ad60a8f Add support for position() and set_position() to C++ slint::Window 2022-07-08 18:37:01 +02:00
ogoffart
6b15d2e479 Bump version number to 0.2.6 2022-07-06 09:58:14 +00:00
Tobias Hunger
dd59d41ee6 Rename init_*_items to register_component
I want to track component structure changes in the window without
generating more code. So use a more generic name for the init_*_items
functions, so that I can add the functionality I need in there.

Also add a register_component to PlatformWindow and call that.
2022-06-30 11:51:49 +02:00
Tobias Hunger
581533f302 Rename free_*_graphics_resources to unregister_component
I want a more generic name as I want to do to track component structure
changes in addition to resource freeing and I do not want to add another
call into the generated code.
2022-06-30 11:51:49 +02:00