Commit graph

889 commits

Author SHA1 Message Date
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
Olivier Goffart
1b9e245b4e Remove the NativeSwitch
It is identical to the NativeCheckBox  (Qt don't have a switch widget)
2023-06-23 11:02:46 +02:00
Simon Hausmann
aa41277df1 Improve safety notes on the slint::Image texture import functions
Elaborate how to call this function safely, and copy the same description to the C++ docs.
2023-06-22 22:31:51 +02:00
Simon Hausmann
ab0e38c76d
Merge absolute-x and absolute-y "virtual" properties into absolute-position (#2942)
The type of thep property is `Point`, which existed before. It was
mapped to `slint::private_unstable_api::re_exports::Point` (euclid) and
is now mapped to slint::LogicalPosition (also in C++).
2023-06-21 08:17:57 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Tobias Hunger
24c822dd60 xtask: Make docs MIT license 2023-06-16 09:14:20 +02:00
Tobias Hunger
04d1229685 Fix licnese information using xtask 2023-06-16 09:14:20 +02:00
ogoffart
641cab0e75 Bump version number to 1.1.0 2023-06-15 16:01:28 +00:00
Simon Hausmann
2e7cc49567 Initial AccessKit support
This change adds initial accessibility support for the winit backend
through use of AccessKit.
2023-06-15 13:20:14 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Olivier Goffart
4dd10f4a78 Make WindowAdaptor::request_redraw public 2023-06-13 20:29:52 +02:00
Olivier Goffart
0e31f097a4 Un-seal the WindowAdapter trait 2023-06-13 17:44:04 +02:00
Olivier Goffart
23b910725f Rename WindowAdapterSealed to WindowAdapterInternal 2023-06-13 17:44:04 +02:00
Olivier Goffart
6341769cbd WindowAdaptor: move a few function to the public trait
Note: the addition of MinimalSoftwareWindow::set_size is there because
it would be a breaking change for user who called set_size on the
MinimalSoftwareWindow while also using the WindowAdapter trait.
This was the case of a test.
The same problem theorically exist with set_position and position, but
is unlikely to be a problem because i don't think people would use the
position with a MinimalSoftwareWindow

The renderer() is now public as well. That's because I want to make sure
that the scealed trait don't have non-provided method
2023-06-13 17:44:04 +02:00
Simon Hausmann
cd9994306e Create the window adapter lazily in C++ 2023-06-13 15:13:42 +02:00
Olivier Goffart
72de76b71a Documentation for enums 2023-06-12 13:02:14 +02:00