Commit graph

9233 commits

Author SHA1 Message Date
Simon Hausmann
56feda7ad9 napi: Fix typo in file name 2023-08-07 13:30:06 +02:00
Olivier Goffart
63ca3509ea
MVU board support README: change the opt-level for the stm32h7 board
Use `CARGO_PROFILE_RELEASE_OPT_LEVEL=s` otherwise the program don't fit in flash
2023-08-07 12:59:31 +02:00
Simon Hausmann
cd0056ca92 Make it easier to use the software renderer with PremultipliedRgbaColor and Rgb565 in "foreign" environments
Implement rgb::Pod/rgb::Zeroable for PremultipliedRgbaColor and Rgb565
Pixel. This allows for bytemuck::cast_slice(), making it easier to copy
software renderer output into another buffer that's the same format but
Vec<u8> for example.
2023-08-07 11:46:43 +02:00
Florian Blasius
b375b67467
Initial setup for napi-rs port (#3171)
* Startup with napi.

* Added interpreter api for napi.

* Initial implementation of set_property/get_property on ComponentInstance

Co-authored-by: Florian Blasius <FloVanGH@users.noreply.github.com>

* fixup! minimal napi setup

* Type conversion for napi.

* Work on napi callbacks.

* Fix life-time of JsFunction kept in closures for callbacks

The life-time of napi values is limited to the method invocation from napi itself.
In order to keep a value beyond that, it's necessary to use persistent references:

https://nodejs.org/api/n-api.html#references-to-values-with-a-lifespan-longer-than-that-of-the-native-method

* Added callback tests for napi.

* Fix licenses for napi stuff.

* Update api/napi/src/interpreter/component_instance.rs

Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>

* Update api/napi/src/interpreter/component_instance.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Code review stuff

* Update api/napi/src/interpreter/component_definition.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update api/napi/src/interpreter/component_instance.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update api/napi/src/interpreter/component_instance.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* code review fixes

* ci fix

* code review fixes.

* up

* Revert "up"

This reverts commit 06412f1acf.

* ci fix

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
Co-authored-by: Florian Blasius <FloVanGH@users.noreply.github.com>
Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-08-07 10:44:05 +02:00
Simon Hausmann
f301e3d8c9 Remove Rust/C++ type name sentence in StandardListViewItem docs
This makes no sense in the Slint docs. But it's okay, this is a really
simple data structure anyway.

Amends 37488f015d
2023-08-03 15:54:54 +02:00
darknight
37488f015d Refactoring: define macro rules to group builtin structs
apply new macro for struct declaration, type register,
doc generation, cpp header generation, struct-value conversion.
2023-08-03 11:01:18 +02:00
Update Translations Bot
3e79b6957c Update Translations: extract strings 2023-08-03 03:04:26 +00:00
Simon Hausmann
0c9199b17f
Add support for flipping borrowed OpenGL textures vertically (#3205)
Closes #2986

Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2023-08-02 13:11:13 +02:00
Olivier Goffart
7ec5b01ff0 C++: Properly enable the software renderer when the feature is enabled 2023-08-02 11:57:02 +02:00
Olivier Goffart
bcbe157712 Native style: Fix animations with the KDE's breeze style
The style use update() on an invisible widget so animations wouldn't
work. As a workaround, capture the MetaCall event
2023-08-02 10:56:25 +02:00
Olivier Goffart
5718b15899 Qt platform: use QWindow::requestUpdate instead of QWidget::update
Otherwise we may repaint too fast

Fixes #3193
2023-08-02 10:56:25 +02:00
Olivier Goffart
b94e3c3886 Update .mailmap to use the slint.dev domain 2023-08-02 08:57:55 +02:00
Tasuku Suzuki
3571396159
ffmpeg example: Change background color to black (#3204)
In general, black background better matches the aesthetics of video
playback apps, making the viewing experience more immersive.
2023-08-02 07:36:38 +02:00
Olivier Goffart
a12b7c416f C++ platform qt example: implement timer events
(so that the line edit cursor blinks)
2023-08-01 17:50:00 +02:00
Florian Blasius
d3bfdf7e7f Added test for LangType to ValueType conversion 2023-08-01 12:24:32 +02:00
Florian Blasius
b3b6126f4b Added missing brush type to ValueType from LangType. 2023-08-01 12:24:32 +02:00
Simon Hausmann
203a5ed431 linuxkms: Tweak mouse cursor appearance
- Fix the viewbox so that cursor isn't squashed but appears in the
  correct ratio.
- Add a ~2 pixel wide white stroke around it, so that it's easier to see
  on dark background.
2023-07-31 20:11:15 +02:00
Simon Hausmann
f3f7d1de33 Don't show live-preview in fullscreen when running VS code with WSL
Generally, disable the fullscreen rendering. This selection mechanism
needs reworking, as one might want to use the live-preview in a setup
where weston, etc. are running side-by-side.

This could be made configurable in the future, i.e. choosing a backend
like linuxkms, or having the window state as property in Slint.
2023-07-31 20:10:49 +02:00
Olivier Goffart
f5caafd379 linuxkms: Implement support for SLINT_SCALE_FACTOR 2023-07-31 19:35:17 +02:00
Olivier Goffart
ad389aa4eb linuxkms: Implement keyboard input and clamp mouse
Unfortunately, this is currently not mapped to the right keyboard layout

Also keep the mouse clamped in the visible area.
And make it start in the middle of the screen.
2023-07-31 17:27:53 +02:00
Simon Hausmann
23ca0cb36c Disambiguate Render trait type name
Use FullscreenRenderer as name for the trait used in the linuxkms backend
2023-07-31 17:11:43 +02:00
Simon Hausmann
868173cc20 Disambiguate the type name SkiaRenderer
- Use WinitSkiaRenderer for the adapter in the winit backend (similar to WinitSoftwareRenderer)
- Use SkiaItemRenderer for the impl of the ItemRenderer trait
2023-07-31 17:11:43 +02:00
Simon Hausmann
b503733d03 Update to a new release of the Rust Skia bindings 2023-07-31 16:18:42 +02:00
Olivier Goffart
0a8f9c585a
C++: expose special key codes constants 2023-07-31 15:11:57 +02:00
Simon Hausmann
ad84114bae Fix build of generated C++ code with older macOS versions
Avoid the use of std::optional<T>::value.

Amends 0ba6ef1c24
2023-07-31 14:37:45 +02:00
Simon Hausmann
d96d37ea4b Fix linuxkms on i915
Adding a framebuffer with the given modifiers fails for some reason. Forcing
the gbm surface to linear is one workaround, but instead
let's use the old API without modifiers but still planar support.

This also removes the dependency to drm-ffi again, which was missing from renderer-femtovg.
2023-07-31 13:47:23 +02:00
Simon Hausmann
6b044ae078 Rename extension trait to use Ext as suffix 2023-07-31 13:06:28 +02:00
Simon Hausmann
84ddfc6c2f Add support for rendering the mouse cursor with linuxkms
The cursor is loaded by the window adapter from the cache. When it's
loaded the first time, its format will be Svg, so we convert it to a
pixel buffer. That way the skia backend can convert it on first draw
into a skia_safe::Image and replace the cache entry with the backend
storage variant.
2023-07-31 13:06:28 +02:00
Olivier Goffart
41f0972e4b C++ platform Qt example: handle key events 2023-07-31 12:58:38 +02:00
Olivier Goffart
a34074db11 Move the C++ specific example to the examples/cpp directory
The platform ones are not experimental so move out of tests
2023-07-31 12:58:38 +02:00
Simon Hausmann
4b2eacd024 Fix build
Amends 717a3d9729
2023-07-31 12:46:58 +02:00
Simon Hausmann
717a3d9729 linuxkms: Add support for planar framebuffers and DRM modifiers 2023-07-31 12:07:33 +02:00
Simon Hausmann
d681864a3b c++: Fix missing platform API Docs
- Fix pre-processor include search path setup so that pre-processing
  slint.h finds slint_internal.h and (most importantly)
  slint_generated_public.h for the feature defines.
- Add missing documentation that caused doxygen errors.
2023-07-31 11:45:01 +02:00
Simon Hausmann
8c289fe3cc Fix doxygen formatting for slint::interpreter::Value::operator== 2023-07-31 11:45:01 +02:00
Simon Hausmann
c2689f3f56 Prospective fix for failing nightly builds
Don't try to install newer packages on older Ubuntu versions
(where we don't need them anyway)
2023-07-29 13:32:16 +02:00
Simon Hausmann
7ff7c2f875 Fix let-else formatting
Nightly now supports it and thus `cargo +nightly fmt` yields a
difference.
2023-07-28 13:43:21 +02:00
Simon Hausmann
8d0b0e945c Add ChangeLog entry 2023-07-28 13:40:37 +02:00
Simon Hausmann
fee44f3f7d Add basic support for libseat
This is not dynamic unfortunately, but at least it forwards device access for OpenGL and remove the need to run it as root.
2023-07-28 13:40:37 +02:00
Simon Hausmann
6eea074aac Upgrade CI to Ubuntu 22.04
Stay with 20.04 for the tool/lsp/vsix binaries. Otherwise use the latest, which is also needed for libseat.
2023-07-28 13:40:37 +02:00
Simon Hausmann
36eaad96ad Add support for terminating the app via ctrl+alt+backspace and ctrl+alt+delete 2023-07-28 13:40:37 +02:00
Simon Hausmann
bf57b32898 Clean up the order of function calls in the event loop
Use the common order of timer update, render, sleep.

This should be equivalent to the previous code.
2023-07-28 13:40:37 +02:00
Simon Hausmann
797de6c6d6 Fix rendering of animations without user input
Update timers before rendering, so that the state is correct.
2023-07-28 13:40:37 +02:00
Simon Hausmann
4991278a2b Improve error propagation when opening DRM devices fails
Print the last error
2023-07-28 13:40:37 +02:00
Luke D. Jones
b907b8f904 linuxkms: iterate over DRI files to find correct device 2023-07-28 13:40:37 +02:00
Simon Hausmann
e40f6c253e linuxkms: Add support for FemtoVG as renderer 2023-07-28 13:40:37 +02:00
Simon Hausmann
236d6ec183 Initial EGL implementation using gbm surfaces 2023-07-28 13:40:37 +02:00
Simon Hausmann
5c9eed62f1 Add a new backend that supports rendering fullscreen with Vulkan
This doesn't require a windowing system, just Linux and Vulkan drivers
that supports the display extensions.

It's called linuxkms as soon this will go beyond Vulkan and also support
EGL and perhaps dumb buffers for software rendering.
2023-07-28 13:40:37 +02:00
Simon Hausmann
de75892841 Vulkan: Add API to create the Skia rendering surface from vulkano surfaces 2023-07-28 13:40:37 +02:00
Simon Hausmann
9d73a05c35 Add a constructor that accepts a surface impl 2023-07-28 13:40:37 +02:00
Simon Hausmann
a71e73b549 Make the surfaces part of the Skia renderer API 2023-07-28 13:40:37 +02:00