Commit graph

404 commits

Author SHA1 Message Date
Olivier Goffart
42bb2bf705 C++: some changes to the Platform API 2023-07-25 17:38:20 +02:00
Simon Hausmann
7d136b6568 Remove the window parameter from the render() function of all the renderers
This makes for a slimmer API and instead we can create the renderer <-> window association
behind the scenes ourselves,
in set_component.
2023-07-25 17:28:08 +02:00
Simon Hausmann
507428b03e
Simplify FemtoVG and Skia renderer API (#3153)
Fold show() into the first time render() is invoked,
and hide() into the Drop implementation.
2023-07-25 17:17:40 +02:00
Olivier Goffart
2a56e25788
C++: rename PlatformEvent to Platform::Task 2023-07-25 16:15:35 +02:00
Olivier Goffart
3137bfe775 C++ Rgb565Pixel 2023-07-25 15:24:59 +02:00
Simon Hausmann
7893ec3fd4 C++: Improve type-safety of NativeWindowHandle API on macOS
Replace void* with forward-declared NSView/NSWindow in NativeWindowHandle::from_appkit
2023-07-25 15:19:56 +02:00
Olivier Goffart
3a2359f107 C++ Pointer dispatch API 2023-07-25 14:03:40 +02:00
ogoffart
aebaa7d6c9 Bump version number to 1.2.0 2023-07-25 10:44:53 +00:00
Simon Hausmann
5c0d88b71e C++: Rename SoftwareRenderer::render_rgb565 to just render() and overload the Rgb8Pixel variant 2023-07-24 14:25:49 +02:00
Olivier Goffart
ed0e4726d1 C++: use esp-backtrace as a panic handler on the esp platform 2023-07-24 12:20:51 +02:00
Florian Blasius
8ce2620aaa
Added cpp ReverseModel (#3132) 2023-07-24 11:32:45 +02:00
Olivier Goffart
3a420d5769 C++ platform: return the updated region from the render function 2023-07-24 09:44:36 +02:00
Simon Hausmann
e9286c1189 Make it possible to build the slint-cpp crate as a static library
This isn't supported on desktop yet, but on MCU it is.

Cargo is instructed to build a dylib and a staticlib, but corrosion
instructs rustc to build only either dylib or staticlib.

Corrosion listens to the BUILD_SHARED_LIBS option and will change the
default for the Slint::Slint INTERFACE_LINK_LIBRARIES to either
slint-cpp-shared or slint-cpp-static. This way the selection is
transparent to the users.
2023-07-21 18:32:45 +02:00
Olivier Goffart
422c39d321 C++ Don't use aligned_malloc because we can't rely on that in esp-idf
Instead, try to do the alignment manually for over-aligned allocations
2023-07-21 17:14:43 +02:00
Simon Hausmann
cc36915241 Add RGB565 rendering function to the C++ software renderer 2023-07-21 09:16:20 +02:00
Simon Hausmann
917cecff85 Add support for embedding bitmap fonts in C++ 2023-07-20 16:20:51 +02:00
Olivier Goffart
70978f88d2 C++: fix constructing zero-size slice with nullptr
We construct zero size slize from std::array in the generated code, and
std::array<T, 0> may have a nullptr as data.  But Slice use a NonNull
internally.
2023-07-20 15:34:36 +02:00
Olivier Goffart
81bb6e2c70 C++ platform: duration_until_next_timer_update and change return type of duration_since_start 2023-07-20 10:58:33 +02:00
Olivier Goffart
de532d372a C++ experimental platform event loop 2023-07-20 10:26:09 +02:00
Olivier Goffart
1805e6c4c1 C++: Make it working to have experimental withoud std 2023-07-18 13:54:59 +02:00
Olivier Goffart
7cffad2c3f C++: add a STD feature enabled by default 2023-07-18 12:44:20 +02:00
Olivier Goffart
a1bf77383f
C++: Add a mechanism to #define features that are enabled (#3103) 2023-07-18 11:49:00 +02:00
Olivier Goffart
c269986af7
Delete slint_config.h.in
Was added by mistake in the previous commit
2023-07-17 22:24:55 +02:00
Olivier Goffart
9f214580a6 Add some changelog entries 2023-07-17 20:29:18 +02:00
Simon Hausmann
8f6669194a Fix disapearing debugging techniques docs from C++ docs
Amends a11c4c42b0
2023-07-17 18:08:31 +02:00
Simon Hausmann
7961bd68e5 Fix inclusion of some C++ interpreter data structures C++ docs
Make sure to generate the public interpreter header file for the docs
xtask unconditionally.
2023-07-17 15:52:42 +02:00
Simon Hausmann
a8c07d64c5 doc: Fix grammar of slint_interpreter::ComponentDefinition::properties() C++ docs 2023-07-17 15:52:42 +02:00
Olivier Goffart
e7c306cf60
Add SLINT_TARGET_CARGO_FLAGS cmake variable
* Add SLINT_TARGET_CARGO_FLAGS cmake variable
2023-07-17 15:43:22 +02:00
Olivier Goffart
3fabff9a0c C++ Platform: allow to override the duration_since_start 2023-07-14 16:12:12 +02:00
Olivier Goffart
008e60b530 C++: implement an allocator that use libc allocator when no_std
It is important to use the same heap, when there isn't a lot of
available memory
2023-07-14 16:12:12 +02:00
Simon Hausmann
06cb0e8703 Make in (theoretically) possible to run the qt platform example against a wayland compositor
This compiles but fails at run-time with

    xdg_surface@24: error 3: xdg_surface has never been configured
2023-07-14 15:33:03 +02:00
Simon Hausmann
648680da6e Fix qt platform example on X11
The "screen" native resource returns a xcb_screen_t pointer while the raw_window_handle's
XcbDisplayHandle::screen field is the screen number.
2023-07-14 15:33:03 +02:00
Simon Hausmann
3565023a15 Improve error handling in C++ Skia Renderer API
- Don't try to create a GLX context when we only have an XCB window handle,
  XLib is required for that.
- Make it possible to create a NativeWindowHandle from Xlib data types.

Fixes #2978
2023-07-14 15:33:03 +02:00
Simon Hausmann
59d869cb84 Fix missing invocation of init() on Items with C++
In Rust, register_component in the run-time library is called unconditionally and
invokes init(). The window adapter is an optional
parameter.

In C++, we'd call register_component only if we had a window adapter, which meant
that we're missing init calls().

Amends cd9994306e
2023-07-14 13:09:45 +02:00
Simon Hausmann
64f1504ab9 Fix rendering of QStyle animations
Allocate a widget per NativeXXX. This way QStyleAnimation objects
created by Qt aren't shared among style options.

Fixes #2045
Fixes #2987
2023-07-14 13:09:45 +02:00
Olivier Goffart
4a505c6788 C++: Make the platform support work without the "std" feature
Add a experimental-platform feature that doesn't include skia
2023-07-14 10:46:21 +02:00
Simon Hausmann
d8fe052cde Fix bad red markup in C++ slint::Model docs
Revert da95051 and fix the link in the substitution instead.

Fixes #2992
2023-07-10 10:13:42 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Olivier Goffart
69567b49ef C++: fix the signature of Size
otherwise compiler complains that "long unsigned int" != "int" on 32bit
2023-07-05 21:48:01 +02:00
Olivier Goffart
9112eaebfb C++: don't use deprecated corrosion variable 2023-07-05 21:48:01 +02:00
Olivier Goffart
aa8ef4e302 C++: add a "std" feature to the slint-cpp crate
And make it no_std otherwise

This is a first step towards getting C++ on MCU (#2136)
2023-07-05 21:48:01 +02:00
Olivier Goffart
9afadf50be Get rid of the "use_modules" workaround
This doesn't seem to be needed anymore with newer rust version.
As long as one symbol from the crate is used, all exported function
from the crate are available.

The reason why some symbols in some module were gone was a bug in rust
that has been fixed, it seems
2023-07-05 13:41:06 +02:00
Olivier Goffart
2023ebc9a9 C++: Fix build with or without the interpeter feature 2023-07-05 09:54:03 +02:00
Olivier Goffart
5a7a052533 C++: Don't generate the interpreter header if the feature is disabled 2023-07-04 18:19:47 +02:00
Olivier Goffart
331e5713c2 C++: Use a static_assert to detect Slint version mismatch
cc #2909 , #223

New message:
```
/home/olivier/slint/build2/examples/gallery/gallery.h:6:73: error: static assertion failed: This file was generated with Slint compiler version 1.1.1, but the Slint library used is 1.1.0. The version numbers must match exactly.
    6 | static_assert(1 == SLINT_VERSION_MAJOR && 1 == SLINT_VERSION_MINOR && 1 == SLINT_VERSION_PATCH, "This file was generated with Slint compiler version 1.1.1, but the Slint library used is " SLINT_VERSION_STRING ". The version numbers must match exactly.");
/home/olivier/slint/build2/examples/gallery/gallery.h:6:73: note: the comparison reduces to ‘(1 == 0)’
```

Previous message:
```
/home/olivier/slint/build2/examples/printerdemo/cpp/printerdemo.h:12218:161: error: conversion from ‘VersionCheckHelper<[...],[...],0>’ to non-scalar type ‘VersionCheckHelper<[...],[...],1>’ requested
12218 | [[maybe_unused]] constexpr slint::private_api::VersionCheckHelper<1, 1, 1> THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME = slint::private_api::VersionCheckHelper<SLINT_VERSION_MAJOR, SLINT_VERSION_MINOR, SLINT_VERSION_PATCH>();
      |                                                                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/olivier/slint/build2/examples/printerdemo/cpp/printerdemo.h:12218:161: error: could not convert ‘slint::private_api::VersionCheckHelper<1, 1, 0>()’ from ‘VersionCheckHelper<[...],[...],0>’ to ‘VersionCheckHelper<[...],[...],1>’
12218 | [[maybe_unused]] constexpr slint::private_api::VersionCheckHelper<1, 1, 1> THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME = slint::private_api::VersionCheckHelper<SLINT_VERSION_MAJOR, SLINT_VERSION_MINOR, SLINT_VERSION_PATCH>();
      |                                                                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                                                                                 |
      |                                                                                                                                                                 VersionCheckHelper<[...],[...],0>
```
2023-06-28 14:16:52 +02:00
Simon Hausmann
6c5f6da473 janitor: the C++ window tests depends on the interpreter 2023-06-28 13:25:52 +02:00
Simon Hausmann
83ccd07a88
C++: Add slint::Window::scale_factor() getter (#3004)
Fixes #3003
2023-06-28 13:24:40 +02:00
Simon Hausmann
246541f44a Prospective fix for pipenv errors about invalid specifiers
PEP 508 requires a comparator for version_one, so specify some.
2023-06-27 10:13:39 +02:00
ogoffart
c8c9496722 Bump version number to 1.1.1 2023-06-26 12:50:02 +00:00
Simon Hausmann
d1daa8dbe4 doc: Document coordinate system expectations for borrowed textures 2023-06-26 12:49:22 +02:00