Commit graph

1507 commits

Author SHA1 Message Date
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
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
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
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
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
Olivier Goffart
3a807e46c1
Renderer feature refactor 2023-07-27 19:11:24 +02:00
Simon Hausmann
f60b2ebde9 Add slint::platform::OpenGLInterface
This allows for the use of the FemtoVG renderer but delegate the GL implementation to the user.
2023-07-27 16:48:57 +02:00
Simon Hausmann
3b29bfe2f6 Change OpenGLContextWrapper to return a generic Error
This is in preparation for making the trait public.
2023-07-27 16:48:57 +02:00
Simon Hausmann
4e7ebdceba Improve zero-size OpenGL surface handling
- Use NonZeroU32 in the OpenGLContextWrapper interface (correct API for the future)
- Don't render zero sized windows with the software renderer and FemtoVG
2023-07-27 16:48:57 +02:00
Olivier Goffart
49485dbf7d SoftwareRenderer: add API to construct and change the buffer type 2023-07-27 14:44:28 +02:00
Tobias Hunger
d47d52bf52 ItemVTable::init(...): Take an ItemRc so that the itan can know where in the Item Tree it is located 2023-07-27 12:04:16 +02:00
Simon Hausmann
af97435463 Replace show()/hide() in the WindowAdapter with set_visible(bool)
This makes for a smaller interface.
2023-07-26 13:53:45 +02:00
Simon Hausmann
f15bc6147e Simplify FemtoVG and Skia renderer APIs: remove resize()
We can convey the new physical window size from the run-time
through the private renderer API
when a window resize event is dispatched.
2023-07-25 19:33:26 +02:00
Simon Hausmann
7649153b3e janitor: silence rust warning 2023-07-25 17:58:46 +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
ogoffart
aebaa7d6c9 Bump version number to 1.2.0 2023-07-25 10:44:53 +00:00
Christian Boelsen
399e9c63d4 Allow Qt windows to run fullscreen with SLINT_FULLSCREEN 2023-07-24 14:52:33 +02:00
Eric
1b0d3b1061
Add edited callback for SpinBox (#3096)
* add edited callback for SpinBox
* fix compile error
* add inline comment for callback definition
2023-07-18 07:53:54 +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
Simon Hausmann
3e420b32ad Fix accessibility tree on Linux when UI has no repeaters
We need to make sure to replace the dummy tree from #3046 with a real tree.
2023-07-10 12:16:19 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Olivier Goffart
4531210952 Fix the accesskit fix
We also need to add the node in the list of node
2023-07-10 08:50:31 +02:00
Olivier Goffart
8009f12646 Attempt to fix a panic in accesskit
On unix, the panic happens since the upgrade from zbus 3.10 to zbus 3.14

```
thread 'test_window_accessor' panicked at 'called `Option::unwrap()` on a `None` value', /home/olivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_consumer-0.15.0/src/tree.rs:274:45
stack backtrace: [...]
   3: core::option::Option<T>::unwrap
   4: accesskit_consumer::tree::Tree::new
             at /home/olivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_consumer-0.15.0/src/tree.rs:274:19
   5: accesskit_unix::adapter::Adapter::new
             at /home/olivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_unix-0.5.0/src/adapter.rs:53:20
   6: accesskit_winit::platform_impl::platform::Adapter::new
             at /home/olivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_winit-0.14.1/src/platform_impl/unix.rs:21:23
   7: accesskit_winit::Adapter::with_action_handler
             at /home/olivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_winit-0.14.1/src/lib.rs:170:23
   8: i_slint_backend_winit::accesskit::AccessKitAdapter::new
             at ./accesskit.rs:62:20
   9: i_slint_backend_winit::winitwindowadapter::WinitWindowAdapter:🆕:{{closure}}
             at ./winitwindowadapter.rs:163:32
  10: alloc::rc::Rc<T>::new_cyclic
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/rc.rs:461:20
  11: i_slint_backend_winit::winitwindowadapter::WinitWindowAdapter::new
             at ./winitwindowadapter.rs:148:23
  12: i_slint_backend_winit::window_factory_fn
             at ./lib.rs:71:5
  13: <i_slint_backend_winit::Backend as i_slint_core::platform::Platform>::create_window_adapter
             at ./lib.rs:220:9
```

The problem is that we get called to create the tree directly from
WinitWindowAdapter::new before the WinitWindowAdaptor is initialized,
So of course, the upgrade from weak is still the pseudo-weak from
Rc::new_cyclic, so the upgrade fails, resulting in a default constructed
`TreeUpdate` which is invalid for the first call as it doesn't have a
tree.

Just give it a tree with a dummy id
2023-07-07 12:51:44 +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
Guilhem Vallat
6845fc2e4e remove clippy::new_ret_no_self warning 2023-06-30 12:28:13 +02:00
Guilhem Vallat
555e191ab4 remove clippy::needless_borrow warnings 2023-06-30 12:28:13 +02:00
Guilhem Vallat
67493a4f3c remove clippy::new-without-default warnings 2023-06-30 12:28:13 +02:00
Guilhem Vallat
d27e0a4852 micro-optim ItemRc::component() returns a ref instead of cloning 2023-06-29 12:38:54 +02:00
Simon Hausmann
07f42afef3 Fix support normalized ranges for Slider with Qt style
The OpenGL Texture import example uses a Slider in the range 0..1. That doesn't work with
QStyleOptionSlider out of the box because it's
using integer values.
2023-06-28 17:42:34 +02:00
Olivier Goffart
734a5b888c Improve winit's backend documentation 2023-06-28 17:08:12 +02:00
Olivier Goffart
7464c0897e Winit don't need a rtti feature 2023-06-28 17:08:12 +02:00
Tobias Hunger
e81a3d40f0 Get rid of more clippy warnings
* Configure clippy to not report about type complexity until *much*
  later
* Configure clippy to only complain about more than 10 function
  arguments
* Properly format safety sections
* Allow unnecessary main functions in doctests in the slint API crate
* AccessKit: Move big block of code before if condition
2023-06-28 14:22:30 +02:00
Tobias Hunger
e02c360000 Clippy polish 2023-06-28 14:22:30 +02:00
Tobias Hunger
8345c6cd79 Do automatic clippy fixes 2023-06-28 14:22:30 +02:00
ogoffart
c8c9496722 Bump version number to 1.1.1 2023-06-26 12:50:02 +00:00
Olivier Goffart
9b59036816 Add licenses symlinks 2023-06-26 13:12:29 +02:00
Olivier Goffart
5fde19d111 winit: cache the size returned by inner_size
So that subsequent call to Window::size() return the same value

Should fix flickering of window size at startup
2023-06-26 12:37:30 +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
4820d29bcb Fix macOS lsp bundle
Avoid duplicating the core-graphics crate, as that leads to linking
errors about duplicate emissions of the cg_event_tap_callback_internal
helper function from the core-graphics crate.

This partially reverts commit d91622d64f

In order to re-apply d91622d64f, winit
needs to release a new version first.
2023-06-23 07:40:43 +02:00