Commit graph

1483 commits

Author SHA1 Message Date
Tobias Hunger
9873cfd7c0 janitor: Run cargo clippy --fix
Only the hand-picked sensible things, not all of it ;-)

Also fix a few typos that cspell complained about when I
tried to commit and some formatting changes that cargo fmt
insisted on when commiting.
2024-03-14 13:42:38 +01:00
Olivier Goffart
b7b5b8a4dc Fix the release script
- Qt backend imples std feature of i-slint-core
 - Android backend must be published before the slint crate
2024-03-14 10:50:18 +01:00
Olivier Goffart
b7e437fb37 Qt: Fix valgrind warning "Conditional jump or move depends on uninitialised value"
The rust_window is initialized shortly after the constructor is
finished, but changeEvent can happen before that/

The warning can be shown in the log of #4803 (but that is not the cause of the bug)
2024-03-11 08:51:29 +01:00
Simon Hausmann
2b2afaf7d8 Work around gbm display not working on Vivante gbm drivers
gbm.rs' lock_front_buffer calls has_free_buffers before calling the underling C lock_front_buffer function on the gbm surface. This has_free_buffers() check succeeds the first time but always fails after that.

However apart from this check, everything else appears to be working perfectly fine. Projects like weston, ksmcube, Qt, or mutter don't do this check beforehand either, so this patch works around gbm.rs by skipping this.

Unfortunately this requires going to gbm-sys directly and implementing the drm traits that require calling the various gbm_bo_get_* functions to retrieve the buffer details for posting to DRM.
2024-02-29 15:18:14 +01:00
Olivier Goffart
318fa02226 winit: Cache locally the last value of the minimize/maximize/fullscreen state
Workaround for https://github.com/slint-ui/slint/issues/4678
Ubuntu's window manager using XWayland would raise the window when calling
set_minimized(false) even it was not minimized

Fixes #4678
2024-02-29 13:13:38 +01:00
Olivier Goffart
3969e09d5b Remove debug output 2024-02-29 11:11:59 +01:00
Olivier Goffart
c4e0f4a265 Android: support for preedit
(Tested with the typewise keyboard)
2024-02-27 18:29:36 +01:00
Olivier Goffart
1fb162936e Android: simplify the text input with SpannableStringBuilder
Also needed some change on the Text item to avoid sending ime callback
for intermediate states
2024-02-27 18:29:36 +01:00
Olivier Goffart
b8f302464c Android: fix first frame not being translated after a rotation 2024-02-26 15:51:23 +01:00
Olivier Goffart
2c5e654dd0 winit: Make sure to keep the minimized state in sync
Tested with kwin on X11 and on wayland
2024-02-26 15:51:05 +01:00
Olivier Goffart
8bc4c4e053 vtable: increase version number to account for breaking change in vtable::Dyn 2024-02-26 14:45:47 +01:00
Olivier Goffart
3910095e4d Tiling for the nine slice images 2024-02-26 12:16:41 +01:00
Olivier Goffart
5e7ddf3a19 Image Tiling
(Doesn't work yet with 9slice)
2024-02-26 12:16:41 +01:00
Simon Hausmann
9aa931f1f8 Fix C++ compiler warning
Remove name for unused QResizeEvent* parameter.
2024-02-23 14:52:31 +01:00
Ralph Minderhoud
9cb1a4a4e0
Add API for minimize/maximize on Window component (#4581)
Closes #4400
2024-02-22 10:40:36 +01:00
Olivier Goffart
440b9ce9cc winit: Remove unused function and don't depend on copypasta on wasm
Nightly Rust start warning about these.
And in the case of wasm we don't even need to depend on copypasta since
we handle the copy paste ourselves
2024-02-21 10:52:04 +01:00
Olivier Goffart
7b2ff89f1c Fix nightly warnings
eg:
```
warning: the item `Box` is imported redundantly
```
2024-02-21 10:52:04 +01:00
Olivier Goffart
bb4f2b1581 Implement 9slice with other renderer 2024-02-13 14:46:27 +01:00
Olivier Goffart
ce6c7f5527 Image: add horizontal and vertical alignment 2024-02-08 18:59:26 +01:00
Olivier Goffart
cb92ba1132 Add ImageFit.preserve and de-duplicate the fitting code 2024-02-08 10:10:56 +01:00
Olivier Goffart
c6180765fc Qt: Fix drawing of rectangle with border == width
If border-width == with or height of the rectangle we're trying to draw,
we will end up drawing an empty rectangle as we substract border-width/2
from both sides.
Rectangle with border-width bigger than half the size of the rectangle
don't make sense anyway, as it is fully covered by the border. So limit
the size of the border to half the size of the rectangle
2024-02-08 10:07:29 +01:00
Olivier Goffart
af8075d1b2 Only enable the Qt backend by default on Linux
The trick is that the backend selector build by default with the
i-slint-backend-qt, but the "enable" feature is only enabled if the
qt-backend feature is enabled explicitly, or on linux from the slint
or slint-interpreter crate
2024-02-07 15:20:03 +01:00
Olivier Goffart
b23c605ac1
Refactoring: Use a trait for Item being Images 2024-02-07 13:28:47 +01:00
Simon Hausmann
367af4fdf4 Align rotation between software renderer and LinuxKMS backend
As discussed a few days ago, let's define rotation to be always
clockwise, as it is done in other graphics frameworks as well as our
own image rotation. This means changing the definition for the
software renderer. Also fixed docs for the enum in the linuxkms backend
that was wrong.
2024-02-07 11:21:59 +01:00
J-P Nurmi
cc5d2b24e5 Add BasicBorderRectangle to avoid unnecessary xxx-border-radius bindings 2024-02-06 18:01:35 +01:00
J-P Nurmi
031742246c Implement clipping 2024-02-06 18:01:35 +01:00
J-P Nurmi
f8ed10b092 Qt: non-uniform border radius 2024-02-06 18:01:35 +01:00
Simon Hausmann
99d87934c0 Fix build with --cfg=web_sys_unstable_apis
Amends fadcbdf726
2024-02-05 11:50:09 +01:00
Olivier Goffart
0db6e96f67 Update version number in android docs 2024-02-04 13:03:37 +01:00
Simon Hausmann
858ed639ec
Fix Android build on Windows (#4530)
- Use Path/OsStr to avoid directory separator mismatches
- Call d8.bat

Fixes #4524
2024-02-02 14:56:00 +01:00
Olivier Goffart
fadcbdf726 Android: send the input type to the input method
Also avoid flickering of the input method when inserting text by
preventing sending an imput method event right after deleting the
selection
2024-02-02 11:54:47 +01:00
Olivier Goffart
41f1f41536 Qt: fix crash when closing the popup window on wayland
Fixes #4500

When the WindowAdaptor is dropped, deleteLater is used on the C++ QWidget.
On wayland, we still recieve a mouse exit event when the widget is about
to be deleted. This calls a callback into the deleted Rust WindowAdaptor.
2024-02-01 09:31:08 +01:00
Olivier Goffart
46dd8b1060 Android: refactor the JavaHelper to avoid that each function has unsafe 2024-01-31 14:56:42 +01:00
Olivier Goffart
d76631431e Android: Split the backend into modules
lib.rs started to be a bit big
2024-01-31 14:56:42 +01:00
Olivier Goffart
fb78bbd702 Android: Don't draw the UI under the system bars or the keyboard 2024-01-31 09:20:19 +01:00
Olivier Goffart
0f14b24cc6 janitor: android: fix warnings and group args together 2024-01-30 18:08:06 +01:00
Olivier Goffart
a9641a2d11 Update version number in the android readme 2024-01-30 15:26:02 +01:00
Olivier Goffart
fa24283cd4 Add a few funciton to make SlintContext usefull
Make it possible to spawn future and run event loop with a SlintContext
handle
2024-01-29 15:34:48 +01:00
Simon Hausmann
13b93a4af1 winit: Change window activation to default to false on for HTML canvas usage
Don't activate the canvas by default, as that causes winit to call focus() on the DOM element, which in turn will forcibly scroll the browser window.
That means any existing anchors are ignored and the user's scroll preference is disturbed.

Fixes #4431
2024-01-29 14:20:55 +01:00
Olivier Goffart
25925b55fd android: detect dark or light style 2024-01-26 15:26:21 +01:00
Olivier Goffart
daa376becd Fix linuxkms compilation and warnings when no features are enabled
Remove a lot of error in rust-analyzer when opening the slint workspace
2024-01-26 13:47:14 +01:00
Olivier Goffart
83adb467c0 Only depends on i-slint-backend-linuxkms on linux, even if the feature is enabled
This allows to simplify the npm build as well
2024-01-26 13:46:11 +01:00
Simon Hausmann
93142bf417 winit: Always make skia-opengl available
The Skia OpenGL renderer is portable and sometimes esp. on Windows produces better results, so make it always available as an open if `renderer-skia` is enabled. `renderer-skia-opengl` continues to select the GL renderer as default.
2024-01-24 18:20:04 +01:00
Olivier Goffart
573d4a3b50 Remove the test function for sending double_click
They are not commonly used so no need to use semi-public api for that
and it's really easy to similate with ust two clicks anyway

The previous test function were added before there was public way to
send events
2024-01-24 10:20:06 +01:00
Olivier Goffart
9113b877bd winit: avoid to poll or call request_redraw too often
Otherwise there will be a huge queue of request redraw command that
accumulate within winit.
This makes operation such as resizing a bit more soomth

Tested on X11
2024-01-22 19:22:16 +01:00
Olivier Goffart
168654fa29 Android: Implement InputConnection
So that we can use text prediction and other input method features
2024-01-21 09:21:41 +01:00
Olivier Goffart
daa40f43cd Android: Use java code to show or hide the keyboard
instead of coding it all in JNI

This uses build.rs to compile the java code into bytecode that is then
embedded in the binary and loaded at runtime
2024-01-21 09:21:41 +01:00
Simon Hausmann
5e23dbe765 Fix reuse compliance check
Current versions of the reuse tool don't allow inline copyright and licsense information in SVG and CSV files anymore. Move those into the dep5 file.
2024-01-18 15:11:43 +01:00
Olivier Goffart
f1f141896f
Fix linear gradiant rendering in non square rectangle
Fixes https://github.com/slint-ui/slint/issues/3730
2024-01-17 17:44:51 +01:00
Simon Hausmann
d9ddc865c2 Fix panic when shutting down process on Linux
Commit 41bfe66447 bumped accesskit
dependencies, which introduced a version that uses threads.

That means the action handler as well as the initial tree update source
closure are destroyed in a thread that's not the ui thread. That means
we destruct a SenderWrapper<Weak<WinitWindowAdapter>> in a thread that
is not the same as the one the wrapper was created in, which causes
Drop for SendWrapper to panic.

Replace the use of SendWrapper here with safely copyable window ids.
2024-01-17 17:07:38 +01:00