Commit graph

889 commits

Author SHA1 Message Date
Tobias Hunger
ee68716d07 Component: Add information to stich together ItemTrees
Add accessors to the information necessary to stitch together the
Component-wide ItemTrees (which include DynamicNodes) into one logical
tree of Items.
2022-03-28 14:13:36 +02:00
Simon Hausmann
df2d6442d4 Make it possible to disable the slint compiler from the CMake build
This isn't always needed, for example when using only the interpreter API,
and its dependency to native libraries on Linux (namely fontconfig) makes it difficult to cross-compile with
CMake.

While cargo is invoked correctly for the native binary build, the library search paths
coming from CMake will be target specific, not host specific.

So for now this provides a way of disabling the compiler.
2022-03-22 12:59:52 +01:00
Simon Hausmann
535e134223 Add a Layer element that's created when using a layer boolean property
For now no backend implements this optimization hint.
2022-03-21 20:22:43 +01:00
Simon Hausmann
9b62b08ed6 Fix CMake setting DT_NEEDED to the absolute soname of libslint_cpp in apps
As per rust-lang/cargo#5045, cargo does not set soname on created
cdylibs. We use corrosion to import our .so into CMake, which ends up
passing the absolute path to the .so to the link line of the
application. Due to the lack of DT_SONAME, this means that DT_NEEDED of
the application contains the full path to libslint_cpp.so. This is
sub-optimal for example for building Yocto SDKs, the build paths should
not end up in the created binaries.

The library should be located using the linker's search paths and the
.so name. For convenience, the application can use rpath to extend those
search paths (and usually CMake already does that), but there is no need
to code the absolute path to the library.

Set the IMPORTED_NO_SONAME CMake variable to work around this.

This can be verified with the steps as in #1066.

Fixes #1066
2022-03-18 16:58:53 +01:00
Tobias Hunger
86a6add32c janitor: Fix typos and make cspell happy 2022-03-18 10:15:44 +01:00
Tobias Hunger
526166090e cmake: Do not break when slint is build with empty CMAKE_BUILD_TYPE
Do not break building against slint using CMake from C++ when no
CMAKE_BUILD_TYPE was set when building Slint.

This just makes sure the build type is properly quoted, which makes sure
we keep a (empty) string token where CMake expects one.

Fixes: #1065
2022-03-17 18:18:20 +01:00
Olivier Goffart
ca5151de11 C++: implement Window::on_close_requested 2022-03-17 14:49:12 +01:00
Tobias Hunger
bdc3778cec Rename init/free item functions back 2022-03-14 09:43:50 +01:00
Tobias Hunger
095537e3fd Remove item from ItemTreeNode
... and make ItemTreeNode non-generic this way.

The Item is now only in the extra ItemArray struct and we are free to
expose the ItemTree further.
2022-03-14 09:43:50 +01:00
Tobias Hunger
5d3f296af9 API: Change WindowRc::free_graphics_resources and init_items on C++
Use the ItemArray in both cases.
2022-03-14 09:43:50 +01:00
Tobias Hunger
1fd14272cf Use item_array in C++ 2022-03-14 09:43:50 +01:00
Simon Hausmann
b34f733716 Point C++ users to the new release/0.2 branch
That way version upgrades to new patch release become easier.
2022-03-10 11:08:58 +01:00
ogoffart
7b50791db4 Bump version number to 0.2.2 2022-03-10 08:48:33 +00:00
Olivier Goffart
3b2b1c92a4 Update version number in docs and readmes
```
sed --follow-symlinks -i 's/^\(slint.*\) = ".*"/\1 = "0.2.1"/' **/*.rs **/*.md
sed --follow-symlinks -i 's/GIT_TAG v.*$/GIT_TAG v0.2.1/' **/*.md
```
2022-03-10 08:46:16 +01:00
Tobias Hunger
ebe3a3c37c cpp: Fix cmake property mapping
Fix the mapping between a projects CMAKE_BUILD_TYPE and the build type
of the imported Slint library.

Fixes #1027
2022-03-09 19:53:06 +01:00
Olivier Goffart
15781411de C++ interpreter: Cast the pointer, not the reference
May result in warnings otherwise

```
slint_interpreter.h:426:79: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  426 |                 &inner, &reinterpret_cast<slint::SharedVector<ValueOpaque> &>(array))) {
      |                                                                               ^~~~~
```
2022-03-09 13:11:05 +01:00
Simon Hausmann
583c7a1b80 Fix C++ build
With ImageInner::StaticTextures (the variant) and StaticTextures (the
struct), we need to disambiguate for the generated enum contructor
functions. This is done by prefixing the enum variant with their name.
2022-03-03 14:39:11 +01:00
Jared Moulton
fdbc8056b3 Add an option to draw *'s instead of characters for password fields 2022-03-02 15:47:32 +01:00
Simon Hausmann
39a2290221
Build the backends without rtti unless needed (#1001)
* Build the backends without rtti unless needed

Only the interpreter needs the rtti generated code.

 * Since `SlintElement` emits `#[cfg(feature = "rtti")]` tokens, each
 crate using `SlintElement` needs to have an `rtti` feature.
 * The selector gets backend specific rtti selection features, in order
   for the interpreter to enable them.
* Enable rtti when building the C++ project with the interpreter enabled
2022-03-01 18:37:07 +01:00
n-raine
beda5aca07 Add dark style detection support for GL backend
With the help of dark-light crate this is now exposed as dark-style
boolean property in NativeStyleMetrics.

Co-authored-by: Olivier Goffart <olivier@slint-ui.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-03-01 16:41:20 +01:00
Olivier Goffart
0dc188f328 Support for referring to other globals from globals
- We need to make sure that the initialization of global is in the right order.
 - In C++ and rust, we need to add accessor to the global component
 - There can be `PropertyReference::Global` in binding of globals
 - The interpreter globals need to hold references to the global they may depend on

Fixes #175
2022-02-28 10:14:34 +01:00
Olivier Goffart
350f0d0d6a
C++ interpreter API: add a Value::Value(int) constructor (#974) 2022-02-21 14:00:51 +01:00
Olivier Goffart
ea2e91ece9 Upgrade Catch2
I get a compilation error otherwise

```
_deps/catch2-src/single_include/catch2/catch.hpp:10830:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
10830 |     static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
      |                                                          ^~~~~~~~~~~

```
2022-02-21 13:30:01 +01:00
ogoffart
ecd0fb7ecd Bump version number to 0.2.1 2022-02-10 16:25:28 +01:00
Olivier Goffart
e429968a15 Update version number in the docs 2022-02-09 17:08:19 +01:00
Olivier Goffart
567b54501a Upate the links to the templates repository
Also update a few more links and reference to slint in the readme
I know this means that we will have invalid links and instructions until the release,
but the instructions are already broken anyway
2022-02-09 15:49:18 +01:00
Olivier Goffart
3d209287c2 Docs: add a note that only exported global from the main file are exposed 2022-02-09 14:49:20 +01:00
Simon Hausmann
b2e6745bd3 Remove two more uses of the sixtyfps.io email 2022-02-09 13:16:51 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Simon Hausmann
6d923b9367 Improve GL backend feature docs to convey cross-platform support
Apply suggestion from code review
2022-02-08 14:47:25 +01:00
Simon Hausmann
fcd1faa336 Fix up the C++ docs explaining how to create a wayland-only build 2022-02-08 14:47:25 +01:00
Simon Hausmann
90d67be1a4 Document the feature renaming in the migration guides 2022-02-08 14:47:25 +01:00
Simon Hausmann
be5b8c1c46 Rename the backend-gl feature to backend-gl-all 2022-02-08 14:47:25 +01:00
Simon Hausmann
48f3f47401 Rename the x11 and wayland features to backend-gl-x11/wayland 2022-02-08 14:47:25 +01:00
Olivier Goffart
753784c331
C++: drops IntSize in favor of Size<T> (#922)
Fixes #909

Since we declare the struct in C++, we don't need to declare it in
rust for cbindgen anymore, as long as we expose the Size2D type from
euclid to the cbindgen_private namespace
2022-02-08 14:12:52 +01:00
Olivier Goffart
40c0e446c8 C++ migration guide: merge the two cmake entries
I kept it at the beginning because that's the first thing to do while migrating
2022-02-08 12:34:57 +01:00
Olivier Goffart
0e0142c9cf Bump Corrosion to v0.1.0 2022-02-08 11:42:54 +01:00
Olivier Goffart
1425ef63de Change the Url from sixtyfps.io to slint-ui.com
Also, change the URL of the logo in the docs
2022-02-08 08:52:46 +01:00
Olivier Goffart
00ff5e21a7 Update git repository URL 2022-02-08 08:26:21 +01:00
Olivier Goffart
91e107150e Merge remote-tracking branch 'origin/wip/rename'
Conflicts:
	examples/opengl_underlay/index.html
	examples/opengl_underlay/main.cpp
2022-02-08 07:29:41 +01:00
Simon Hausmann
ee59e9931f Use the logo URL for the C++ docs
It appears that

    https://github.com/readthedocs/sphinx_rtd_theme/pull/1171

and

    https://github.com/sphinx-doc/sphinx/pull/9381

have been released in their respective packages and we can use the logo url in our docs.
2022-02-07 17:22:18 +01:00
Simon Hausmann
906aa0b8c2 Use Tobias' new adjusted diagram 2022-02-07 16:23:41 +01:00
Tobias Hunger
de4e195280
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs.

Add README.md files to all internal crates

... pointing to the official public crate to use instead.

Rename internal crates

fixup: README files

fixup rename
2022-02-07 13:12:48 +01:00
Simon Hausmann
0b6beb081b Minor fixup to the C++ rendering notifier API
Add the graphics state enum to the callback, too. When we add support for different backends,
it would be nice if it didn't require an API change.

 It's duplicated from Rust
because it doesn't provide values. The WebLG one doesn't make sense for C++ and
the proc address closure isn't ffi safe.

(It could be manually bridged thought)
2022-02-07 08:50:09 +01:00
Olivier Goffart
4115af88bd Fixup previous merge 2022-02-04 17:43:15 +01:00
Simon Hausmann
125b90a64b Merge remote-tracking branch 'origin/master' into wip/rename
Conflicts:
	api/cpp/cbindgen.rs
	api/cpp/include/slint.h
	examples/CMakeLists.txt
	examples/imagefilter/Cargo.toml
	examples/plotter/main.rs
	internal/backends/mcu/lib.rs
2022-02-04 16:47:20 +01:00
Simon Hausmann
18bba6ede4 Add sixtyfps::Window::request_redraw()
This allows scheduling a redraw of a Window explicitly. Unfortunately it
comes with a winit caveat :(
2022-02-04 15:41:53 +01:00
Simon Hausmann
8959eac3d0 Add rendering callbacks to sixtyfps::Window
This API allows specifying a callback that will be invoked when setting
up graphics (great for compiling shaders), before rendering a frame (but
after the clearning of the surface background), after rendering a frame
(before swapbuffers) and when releasing graphics resources.
2022-02-04 15:41:53 +01:00
Tobias Hunger
c273537990
Use logos from the logo folder over the vscode-extension icon 2022-02-04 14:28:10 +01:00
Tobias Hunger
c2d4924294
Use new logo in C++ docs 2022-02-03 14:27:15 +01:00