Commit graph

1483 commits

Author SHA1 Message Date
Olivier Goffart
0597313af8 Skia needs raw-window-handle 0.5
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-10-23 14:22:48 +02:00
Olivier Goffart
28c67294cb softbuffer needs raw-window-handler 0.5 traits 2023-10-23 14:22:48 +02:00
Olivier Goffart
087ed3a8c5 Update to released version of winit 0.29 and glutin 2023-10-23 14:22:48 +02:00
Olivier Goffart
e3dae193f6 winit: Use run_ondemand instead of pump_events
That should be the same, but run_ondemand is showing the intend more
2023-10-23 14:22:48 +02:00
Olivier Goffart
58e5d62a02 Winit port: Fix wasm build
Port everything from instant to web-time
2023-10-23 14:22:48 +02:00
Olivier Goffart
12cd8e71f1 WIP: some polish over the winit update to 0.29 2023-10-23 14:22:48 +02:00
Olivier Goffart
0fac958ebf Revert "Fix touch events not working for wasm builds"
This reverts commit 5879e1ec71.

We will update to next version of winit:
Closes #2424

 Conflicts:
	internal/backends/winit/Cargo.toml
	internal/backends/winit/event_loop.rs
	internal/backends/winit/glwindow.rs
	internal/renderers/skia/Cargo.toml
2023-10-23 14:22:48 +02:00
Tobias Hunger
58d61606cc Winit update to master
Conflicts:
	internal/backends/winit/event_loop.rs
	internal/common/key_codes.rs
2023-10-23 14:22:48 +02:00
Tobias Hunger
1e8574aa74 cleanup: rename a private function 2023-10-23 14:22:48 +02:00
Simon Hausmann
e0cc2e30a3 skia: Avoid unsafe in favor of bytemuck::cast_slice_mut 2023-10-23 13:55:23 +02:00
Simon Hausmann
3855de0794 winit: Add support for selecting Skia's software renderer directly
That might be useful for debugging
2023-10-23 13:55:23 +02:00
Simon Hausmann
f7d666b948 winit backend: clean up renderer creation
Pass around a factory function to create the renderer,
instead of a factory function that creates the window adapter. The adapter is
always the same anyway, and this way the WinitWindowAdapter's new
also doesn't have to be generic.

This also prepares for adding a second skia renderer
constructor later to select a specific variant.
2023-10-23 13:55:23 +02:00
Simon Hausmann
60901a27ff skia: Fall back to software rendering if GPU accelerate rendering fails to initialize
At the moment this is only supported for the winit backend and the C++
API. linuxkms uses a different SkiaRenderer constructor.
2023-10-23 13:55:23 +02:00
Simon Hausmann
0aa4c42989 skia: Add support for Skia's software renderer 2023-10-23 13:55:23 +02:00
Simon Hausmann
d9672c5a21 linuxkms: Initialize xkb lazily
This has two benefits:

- It improves start-up time for device that are touch-only because
  the xkb parsing is delayed until a keyboard is attached and key is
  pressed
- It fixes #3678 by working around the situation where xkb would
  crash if the xkbcommon data files (in /usr/share/X11/xkb) aren't
  there. Sadly, no error is reported in that case (that we could
  handle), instead just crashes.
2023-10-16 19:03:10 +02:00
Florian Blasius
030cf2cd19
Update scroll offset on ScrollView on ScrollBar scroll-event (#3668) 2023-10-16 10:41:39 +02:00
Tobias Hunger
b12575a4c4 janitor: Go over our spell checking setup
* Extend the cspell word list
* Remove those extensions from individual source files
* white-list licenses and such as we should not meddle with those
* Fix spelling
2023-10-16 09:01:51 +02:00
Simon Hausmann
0d35e01724 Revert "linuxkms: Update drm and gbm dependencies"
This reverts commit 17afe1aa8a.

This causes

 thread '<unnamed>' panicked at 'assertion failed: (has_modifier && modifier.is_some()) || (!has_modifier && modifier.is_none())', drm-0.10.0/src/control/mod.rs:324:9

when running on qemu-virgl.
2023-10-13 15:21:15 +02:00
Florian Blasius
e83f3c8068
Added SpinBoxBase, use scroll-event to change value. (#3665) 2023-10-13 13:37:20 +02:00
Simon Hausmann
17afe1aa8a linuxkms: Update drm and gbm dependencies 2023-10-13 08:54:59 +02:00
Olivier Goffart
40cbdd17f3 Janitor: linuxkms: slint-ui.com -> slint.dev 2023-10-11 08:28:31 +02:00
Simon Hausmann
1c37a7ed60 linuxkms: Prospective fix for touch input when SLINT_SCALE_FACTOR is set
When supplying logical touch coordinates to the slint::Window, scale
them to the logical screen size, not the physical one.
2023-10-09 16:47:37 +02:00
Simon Hausmann
b31d6c464a linuxkms: Add support for motion pointer events with absolute coordinates
When using qemu we receive these, for example.
2023-10-09 12:12:04 +02:00
Olivier Goffart
852b4d906d Rename ComponentVTable to ItemTreeVTable
and their related name.
Also move the component module in the item_Tree module
register_component -> register_item_tree
ComponentItemTree -> ItemTreeNodeArray

For #3323

Rationale from that issue:

Right now, we use the term `component` in the Slint language and in the compiler to be a a tree of elements that can be used as an element in a .slint file.

The term is also currently used in the runtime as a tree of runtime Items that are allocated together. (declared in ComponentVTable)

But there are no 1 to 1 mapping between a `component` in the slint language, and a runtime Component.
(for example, the items behind a `if` or `for` or `PopupMenu` are in a different runtime component. And `component` declared in Slint are often inlined)

So we should rename the internal runtime `Component` to  `ItemTree`

The currently public `slint::ComponentHandle` wraps the "root" of the ItemTree, but that's ok because it is generated from a .slint `component`,  so it doesn't change name
2023-10-09 11:01:56 +02:00
Simon Hausmann
186c3ef3cb Simplify filter/map expression
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2023-10-07 11:26:17 +02:00
Simon Hausmann
b6b3dfc9c0 linuxkms: Prospective fix for failing crtc setup
If the chosen connector doesn't have a current encoder (who's crtc we could use), fall back to the algorithm described in

    https://manpages.debian.org/testing/libdrm-dev/drm-kms.7.en.html#CRTC/Encoder_Selection

for selecting the crtc (minus the usage check, since we drive only one connector).
This is also the same logic as in kmscube.
2023-10-07 11:26:17 +02:00
Simon Hausmann
3a56bcd2a4 Fix build of linuxkms backend on Yocto
We enable libseat's custom_logger feature by default, which redirects
log output from libseat into the Rust log facade. That's nice, but as
part of the implementation of this feature unfortunately libseat's
build.rs unconditionally adds /usr/local/include to the list of the
search include paths when compiling the log_handler.c file. That breaks
the Yocto build, rightly so:

warning: cc1: error: include location "/usr/local/include" is unsafe for cross-compilation [-Werror=poison-system-directories]

We can do without this feature, so let's not enable it.
2023-10-04 22:17:02 +02:00
Simon Hausmann
afbe73414e
Fix winit backend crate description 2023-10-02 23:02:33 +02:00
Olivier Goffart
d688f37ee8 Change alias to the native style depending on the platform
Fixes #3431
2023-09-29 17:05:10 +02:00
Olivier Goffart
89c269e1b9 Unpin winit version
The new version of winit fixes an important bug for macOS Sonoma,
and the bugvix for the workaround won't happen before winit 0.29.
The branch that port to winit 0.29 already removed the workaround

Fixes #3559
2023-09-28 10:10:58 +02:00
Tobias Hunger
85e1c6020b janitor: Use workspace dependnecies for the slint crates
This moves most of the version information we need to update into one
place.

Note that the workplace dependency features are in *addition* to any
feature set when using the workspace dependency. So we have all
workspace dependencies defined with `no-default-features = true`.
2023-09-25 16:34:16 +02:00
Tobias Hunger
d6695c55cb Janitor: Use cargo workspace package data more 2023-09-25 16:34:16 +02:00
Olivier Goffart
0b4bfd3a40 Qt style: Fix GroupBox not being clipped
Fixes #3541
2023-09-25 12:35:41 +02:00
Olivier Goffart
9466819421 Qt style: fix enabled state in some widgets 2023-09-25 10:48:51 +02:00
Olivier Goffart
d3ed4dfad0 Qt Widgets: set the preferred-size to the minimum-size
Instead of setting it to 0 which cause `widget.preferred-width` ti be 0

Fixes #3527
2023-09-22 14:31:46 +02:00
Olivier Goffart
4446a17b24 Skia renderer: reset the surface when the app is resumed on android
Part of #3430
2023-09-21 17:23:08 +02:00
Simon Hausmann
fd123b27bd Default to vsync for OpenGL rendering
Fixes #3516
2023-09-20 12:00:04 +02:00
Olivier Goffart
86402483f8 qt style: Fix animation when the QStyle uses update() on the widget
Example Breeze do that.

Fixes #3482
2023-09-19 21:39:59 +02:00
Thorbjørn Lindeijer
7ee17d0914
Native style: Fixed scroll bar handle size for ScrollView (#3489)
This reverts commit 07f42afef3, but applies
the same change specifically to the Slider, without affecting the
ScrollView.

The scaling up by factor 1024.0 of the min, max and value caused problems
for the ScrollView, which needs these values to match the viewport size
in order to correctly calculate the size of the scrollbar handle.
2023-09-19 10:07:25 +02:00
Olivier Goffart
46ec7875ed Software renderer: partial rendering with winit and fix non-opaque background
Implement the partial rendering with winit and our software renderer.

When the background is not opaque, we must still initialize all the
pixel with 0 otherwise we blend over the previous frame.
(That wasn't visible before because the buffer was always empty)
2023-09-13 16:08:57 +02:00
Guilhem Vallat
5cf1a45e41 Remove duplicated geometry properties from items 2023-09-13 16:08:37 +02:00
Olivier Goffart
06fc251729 Remove the geometry on ItemVTable 2023-09-13 16:08:37 +02:00
Simon Hausmann
906430416f Update softbuffer dependency
This way we're sure to pull in the fix for rendering
on X11 wire protocol, used under WSL.
2023-09-12 09:32:22 +02:00
Simon Hausmann
3652f58a3f Change item indices from usize to u32
So that the compiler and run-time can never disagree on the
number of bytes the item index can use.
2023-09-12 08:53:58 +02:00
Olivier Goffart
6e1132726a winit-sw: Loop over the buffer instead of using indices
It is possible that softbuf allocate a larger buffer than in needs?

Prospective fix for #3406
2023-09-06 16:04:03 +02:00
tronical
b8b9db4e42 Bump version number to 1.3.0 2023-09-05 15:46:36 +02:00
Simon Hausmann
dae978a0f9 Fix HighDPI rendering on Windows when using Qt as default backend
When not explicitly selected, we would construct the Backend struct as-is,
without calling `new()`. Therefore we would
miss the call to ensure_initialized() and
later set the Qt::AA_PluginApplication
application attribute, which screws up rendering.
2023-09-01 11:40:31 +02:00
Olivier Goffart
95b6eda10b Make sure PLatformError is Send+Sync as it is needed for anyhow 2023-08-31 20:52:10 +02:00
Olivier Goffart
4920224be0
Rename Slider::vertical to Slider::orientation 2023-08-30 13:43:59 +02:00
Olivier Goffart
fde561a56a Some improvements to Window visibility
- From C++, always call the Window::show() and hide() function instead
   of going through set_visible directly as it doesn't set the size of
   the WindowItem
 - show() should also call resize on the renderer
 - remove the is_visible in the WindowAdapterInternal as it is no longer
   needed
2023-08-30 13:05:35 +02:00