Commit graph

1368 commits

Author SHA1 Message Date
J-P Nurmi
031742246c Implement clipping 2024-02-06 18:01:35 +01:00
J-P Nurmi
1971f598bb SW: non-uniform border radius 2024-02-06 18:01:35 +01:00
J-P Nurmi
51457025bf Add BorderRectangle::border_top|bottom_left|right_radius 2024-02-06 18:01:35 +01:00
J-P Nurmi
9644f62f00 Add BorderRadius helper type 2024-02-06 18:01:35 +01:00
Olivier Goffart
09a5c724bf ListView: Fix redraw when model changes
Amend 48180919da
That commit added the dependency, but did not reset the dirty flag, so
it only worked once.

Fixes: #4538
2024-02-05 15:02:44 +01:00
Olivier Goffart
f73c08304c PopupWindow: explicitly call set_visible(false)
For native PopupWindow (qt backend) instead of relying on the destructor
to close the popup (usually in the next event loop, if no one had a hold
on any ComponentRc from the popup) do call set_visible(false) so the
popup can be hidden immediatly

CC: https://github.com/slint-ui/slint/discussions/4532#discussioncomment-8366080
2024-02-05 13:47:55 +01:00
Olivier Goffart
1a4528e447 Fix integrity of FilterModel and ReverseModel when removing or adding rows
The ReverseModel had a bug that it didn't compute the index correctly
when removing several rows at the time

The FilterModel didn't adust its internal mapping if the row that was
removed was filtered out.

That caused a bug that can be reproduced in the todo demo:
Check "hide done items" and "Sort by name", then click "Remove Done
Items", then add a new entry and it panicked.
2024-02-05 12:04:30 +01:00
Olivier Goffart
910aecea4d Models: Add an integrity check and fix overflow in the ReverseModel
Fix the ReverseModel: Querying the model out of bound
(which the iterator does) should return None
2024-02-05 12:04:30 +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
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
a464877934 Janitor: update strum dependency 2024-02-01 17:12:33 +01:00
Olivier Goffart
91adad0079 Fix panic in the software renderer when rendring Qt widget
we shall never have a geometry that is bigger than the image we want to
render
2024-02-01 11:42:13 +01:00
Olivier Goffart
2ede92b3f1 Fix 90deg gradients
Fix #4495
2024-01-31 20:44:45 +01:00
Olivier Goffart
e0efbc49bd Set the WindowItem geometry in WindowInner::set_component
Notmaly the geometry is set in WindowInner::show()
But when calling set_component on an existing window, this is not
called.
This Fixes the slint-viewer reloading with the software renderer.
2024-01-31 13:54:45 +01:00
Olivier Goffart
91c2b38fa2 Fix gradiant drawing
Fixes #4459
2024-01-30 09:59:31 +01:00
Olivier Goffart
4a4816afb2 Hold a SlintContext in the Window 2024-01-29 15:34:48 +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
Olivier Goffart
18022b16b0 Move the SlintContext to a different module 2024-01-29 15:34:48 +01:00
Olivier Goffart
3ffe7e7be9 Input method: re-send the text if we notice that the text has changed when rendering
Otherwise, programatic changes to the text are not told to the input
methods.
This is important in the case of the todo example on android.
For example if one type
`foo<enter>bar`, the enter will cause foo to be added in the list, and
the text will be cleared. But then when typing bar, the input method
things "foo" is still in the text and "foo" will be re-added
2024-01-26 13:47:33 +01:00
Olivier Goffart
fce2a80a54 TextInput: Only send the IME if we have the focus
As a side effect this fixes the infinite recursion from #4390
because there is a prevention that focus being sent to the element
inside a ComponentContainer (the bug is that this cause the size to be
computed which cause recursion)
2024-01-24 13:10:31 +01:00
Olivier Goffart
5ee47c78e6 TouchArea: reuse the click_count field in the event instead of re-implementing our own 2024-01-24 10:20:06 +01:00
Olivier Goffart
808db75022 Make sure that double click on two different item is not registered as double click
This is going to be tested as part of tests/cases/elements/toucharea_doubleclick.slint
once we used the click_count for the double_click callback
2024-01-24 10:20:06 +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
Simon Hausmann
6ce394b90a Fix initial animation tick before the event loop runs
As soon as we have a backend, we might as well initialize the timer tick. This fixes animations not starting when run from user init callbacks.

Fixes #2809
2024-01-24 09:33:59 +01:00
Olivier Goffart
01336be871 Fix svg loading on android after update of resvg
It would incoditionally try to load the FONTDB that can't load any font
from the system using libloading

Instead, hardcode the path to the font to a known android font
2024-01-23 23:04:59 +01:00
Simon Hausmann
5a49c21c25 Remove unnecessary Pin::new_unchecked in ffi for item member functions 2024-01-23 18:08:27 +01:00
Olivier Goffart
f5bba87db0
Docs: explain how to use tokio futures
Discussed in https://github.com/slint-ui/slint/discussions/4377
2024-01-23 17:43:36 +01:00
Olivier Goffart
c7aae4b77e Update resvg and related dependencies 2024-01-22 16:16:35 +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
Olivier Goffart
89e252b268 Janitor: upgrade web-time
Increased its version to 1.0 without changes
2024-01-17 15:26:03 +01:00
Tobias Hunger
fe0ac9d6e8 FIX: lsp: Improve URL encoding 2024-01-15 14:46:39 +01:00
Simon Hausmann
a3bb475500 Prospective build fix for no_std build with serde enabled 2024-01-11 18:02:51 +01:00
Olivier Goffart
9111946a82
Introduce slint::run_event_loop_until_quit
Closes #1499
2024-01-11 13:52:02 +01:00
Tobias Hunger
ad026d2a4c core: Change double-click to always send clicked first
Change the double-click implementation to send after two click events
were sent first.

This gets rid of the wait when a double-click handler is installed
before delivering the click.
2024-01-10 11:41:55 +01:00
Simon Hausmann
438b9afeaa
Reduce WindowAdapter API slightly (#4304)
Move the set_fullscreen function added to the WindowAdapter trait in 779aff0b39
to be a function in WindowProperties instead.
That way it'll be easier in the future to extend this with other window states without
having to modify or break the WindowAdapter trait API.
2024-01-09 18:55:06 +01:00
Harold
779aff0b39
Added set_fullscreen API to WindowAdapter. (#4286)
See #3283
2024-01-09 15:23:23 +01:00
Tobias Hunger
9faffc75bb janitor: Fix warnings about unused members
I get warnings about unused members using the nightly compiler, one for
each member in all structs that derive the `FieldOffsets` macro. That is
a lot.

This fixes that as well as the one occurrence of that same warning in
unrelated code.
2024-01-09 10:48:19 +01:00
Olivier Goffart
9ff13faee8 Implement the quitting on windows close in i-slint-core and not in the platform
Step towards #1499
2024-01-08 21:17:52 +01:00
Olivier Goffart
503baf2898 internal: Move the backend global instance in a SlintContext
The SlintContext will hold all the thread_local state.
A small step in the direction of #4294
2024-01-08 21:17:52 +01:00
Simon Hausmann
05079f79fb doc: Fix typo 2024-01-08 10:08:05 +01:00
Olivier Goffart
e90dfdc41c TextInput: fix focus and virtual keyboard behavior on press/release
I've tried to make sure the behavior match the one of native Window (and
Qt on Linux) apps, and android apps.
Windows set the focus on press, but android set the focus on release.
Also, the paste selection on middle click happens on release on Linux.

On android, when taping a text edit that currently has the focus,
we should show the virtual keyboard again if it was hidden by the user.

Having platform specific behavior like this in i-slint-core is not
optimal, but on the other hand, I'm not sure this deserve a new function
in the Platform trait
2024-01-07 12:42:13 +01:00
Brandon Fowler
3e8940660b
Add set-selection-offsets function to TextInput, TextEdit, and LineEdit (#4197)
The function accepts two arguments that specify the start and the end of the text to select.

Fixes #4164
2024-01-06 11:12:53 +01:00
Simon Hausmann
ed54581aa1 Fix support for creating context menus on mouse press
When bringing up a popup menu on mouse press,
don't close it on release if the pointer is inside.
2024-01-06 10:45:34 +01:00
Simon Hausmann
c5aebcfde3 Fix close behaviour of PopupWindow
- Close on release when the mouse pointer is inside the popup
- Close on press when click is outside
2024-01-06 10:45:34 +01:00
Olivier Goffart
48180919da ListView: ensure that we track change to the model
Fixes #3125
2024-01-05 09:17:19 +01:00
Olivier Goffart
458302d431 Additional tests for double-clicking
Relates to #4235
2024-01-04 14:38:43 +01:00
Olivier Goffart
908c68f2a1 TextInput: inserting empty string should do nothing
So that we don't erase selection or call edited unless there is
something typed.

Workaround a bug in which plasma/wayland sends many empty ime event:
```
WindowEvent { window_id: WindowId(WindowId(94309690701616)), event: Ime(Preedit("", None)) }
```

Fixes #4184
2023-12-19 15:36:59 +01:00
Olivier Goffart
672820be0e Inline the Color accesor functions
Profiling reveal they are not always inlined, despite they are only a
single instruction and can be used in a tight loop. So there is no
excuse to not inline them.
2023-12-19 13:24:48 +01:00
Olivier Goffart
34face122e
api: give proper panic message to a function that can panic from bad use
Also use #[track_caller] as the source location should point to the user's
source code as this is where the bug is
2023-12-19 10:45:13 +01:00
Simon Hausmann
95044c3a09
Rename WindowRotation to RenderingRotation in the software renderer (#4181)
Same term as we're going to use in the linuxkms backend.
2023-12-19 08:47:55 +01:00