Commit graph

741 commits

Author SHA1 Message Date
Olivier Goffart
da83857a60 Remove embedded_graphics dependency from i-slint-core
This feature was never used.
2023-06-22 14:12:01 +02:00
Tobias Hunger
501024aa02 Fix: Handle AltGr on Windows
AltGr on windos sends a left control pressed followed by AltGr pressed
on both winit and Qt. On AltGr release it sends left control released
followed by AltGr released.

So unset left control on windows once AltGr is pressed to avoid treating
special characters entered via AltGr key combos to be treated as control
sequences -- leading to the input being ignored!

Also treat `Alt-Ctlr-X` as `AltGr-X` on windows.

Fixes: #2933
2023-06-21 21:03:50 +02:00
Olivier Goffart
31fc7cdd08 Janitor: Some dependencies update 2023-06-21 17:24:57 +02:00
Olivier Goffart
613992d0dc LSP: fix errors or panic when exiting
Two problem:
 1. we were calling quit_event_loop from another thread, which didn't
    work with winit
 2. we need to ignore error from the lsp-server when shutdown as it may
    result in https://github.com/slint-ui/slint-cpp-template/issues/15

Closes https://github.com/slint-ui/slint-cpp-template/issues/15
2023-06-21 16:34:16 +02:00
Simon Hausmann
c81a3f7b64 Remove yeslogic-fontconfig dependency
We need only 9 different functions from fontconfig and one data
structure.  We can do that interaction with libloading by hand and avoid
causing issues like servo/font-kit#212
2023-06-21 12:13:18 +02:00
Simon Hausmann
ab0e38c76d
Merge absolute-x and absolute-y "virtual" properties into absolute-position (#2942)
The type of thep property is `Point`, which existed before. It was
mapped to `slint::private_unstable_api::re_exports::Point` (euclid) and
is now mapped to slint::LogicalPosition (also in C++).
2023-06-21 08:17:57 +02:00
Olivier Goffart
08e20c8586 Don't emit clicked when the pointer did not press the area
eg: releasing the pointer over a button that wasn't pressed shouldn't
click it

Fixes #2918
2023-06-20 16:06:12 +02:00
Olivier Goffart
bf8bbeda40 Take self by value in JoinHandle::abort 2023-06-20 11:36:36 +02:00
Simon Hausmann
a13ad77820 Fix rendering of spawn_local example in the docs
Remove leading triple-slash (and added trailing closing fence, although it also works without).
2023-06-20 08:24:59 +02:00
Simon Hausmann
a84aa70cd0 Fix rendering of scale SVGs
Commit c8f1f4354b accidentally inverted
the target size computation logic when porting away from FitTo, scaling
to the tree width instead of scaling the tree width to the image element
width but preserving aspect ratio.

Fixes rendering of AboutSlint in gallery.
2023-06-19 22:39:39 +02:00
Simon Hausmann
653b63a35e Port to resvg 0.34 2023-06-18 08:58:09 +02:00
Simon Hausmann
c8f1f4354b Port to resvg 0.33 2023-06-18 08:58:09 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Tobias Hunger
04d1229685 Fix licnese information using xtask 2023-06-16 09:14:20 +02:00
Olivier Goffart
99ab5e78d4 Implement a way to run future on the slint event loop
Closes #747
2023-06-16 08:35:19 +02:00
ogoffart
641cab0e75 Bump version number to 1.1.0 2023-06-15 16:01:28 +00:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Olivier Goffart
4dd10f4a78 Make WindowAdaptor::request_redraw public 2023-06-13 20:29:52 +02:00
Olivier Goffart
ff6653c77e Hide the renderer() function from the public API 2023-06-13 17:44:04 +02:00
Olivier Goffart
0e31f097a4 Un-seal the WindowAdapter trait 2023-06-13 17:44:04 +02:00
Olivier Goffart
23b910725f Rename WindowAdapterSealed to WindowAdapterInternal 2023-06-13 17:44:04 +02:00
Olivier Goffart
f4dba7bcfd Seal the Renderer trait
Because we need to make the Render trait public so one can re-implement
the WindowAdapter trait
2023-06-13 17:44:04 +02:00
Olivier Goffart
6341769cbd WindowAdaptor: move a few function to the public trait
Note: the addition of MinimalSoftwareWindow::set_size is there because
it would be a breaking change for user who called set_size on the
MinimalSoftwareWindow while also using the WindowAdapter trait.
This was the case of a test.
The same problem theorically exist with set_position and position, but
is unlikely to be a problem because i don't think people would use the
position with a MinimalSoftwareWindow

The renderer() is now public as well. That's because I want to make sure
that the scealed trait don't have non-provided method
2023-06-13 17:44:04 +02:00
Simon Hausmann
d48e7192d8 Provide a more idiomatic API for accessible_descendents
With just the Qt accessibility support, this is not impactful.
But with accesskit it'll be useful to avoid the intermediate vector of ItemRcs
and map directly to a different data structure.

Otherwise, this is a trade-off between the stack allocation of the recursion and
instead allocating the stack of pending itemrs
on the heap.
2023-06-13 11:20:30 +02:00
Olivier Goffart
5f84cd5a90 Change the return type of WindowAdapterSealed::position to be an Option 2023-06-12 19:25:33 +02:00
Olivier Goffart
facb471d9b Update a comment 2023-06-12 19:25:33 +02:00
Simon Hausmann
01b00d26eb Rust: Allocate the window adapter lazily
This will be needed for embedding - to avoid creating two window
adapters - and it will be needed for the API to allow creating a
component from an existing window.
2023-06-10 11:41:04 +02:00
Tobias Hunger
9c50da9bde
janitor: Fix a few typos 2023-06-08 18:12:52 +02:00
Simon Hausmann
c813e80b48 Fix rendering of links in data structures where docs are shared between C++ and Rust
- in SetRenderingNotifierError using a rustdoc link breaks the C++ docs. Using a qualified backtick'ed slint::Window works perfect with both.
- In TimerMode, the same track unfortunately doesn't work with a function,
  but we can use [`Foo::bar()`] to make the link work with rustdoc and myst-parser.
  The look isn't perfect in C++, the square brackets are visible.
2023-06-08 10:02:15 +02:00
Olivier Goffart
db6110f3a9 janitor: move the test closer to the code they test 2023-06-07 17:32:56 +02:00
Olivier Goffart
12e6b34e2d Translations: support for plurals 2023-06-07 10:34:34 +02:00
Simon Hausmann
0eab14139e Add convenience implementations of From for ModelRc from slices and arrays
Fixes #2787
2023-06-06 14:38:52 +02:00
Simon Hausmann
1bf05eae7c
Add support for absolute-x and absolute-y properties on any element (#2823)
Fixes #1691
2023-06-06 14:37:53 +02:00
Olivier Goffart
895c97a4df Don't use gettext on windows after all because it's broken, also on wasm
`https://github.com/Koka/gettext-rs/issues/12`
2023-06-05 16:34:59 +02:00
Olivier Goffart
57d41b44b5 Enable runtime translations from rust 2023-06-05 16:34:59 +02:00
Olivier Goffart
bbc50edd29 Make translation work in the viewer 2023-06-05 16:34:59 +02:00
Olivier Goffart
cf746ddf8d WIP: formatting implementation of translate in rust and C++ 2023-06-05 16:34:59 +02:00
Olivier Goffart
a3855f1bcb WIP: add a formatting function that works in the interpreter 2023-06-05 16:34:59 +02:00
Olivier Goffart
bef2e3617d Fix ListView panic when setting a new model
.. that has less items and the ListView is scrolled.

We should not have an offset that is higher than the current count
otherwise we're going to access invalid item in the model

Fix #2780
2023-06-05 15:52:06 +02:00
Simon Hausmann
f9ba8023d4 Fix read-only TextInput reporting input method access
When the TextInput item is read-only, it should not report availability
or any other status to the input method via the window adapter.

This also fixes the order of events when clicking on a TextInput: We
would send the ime position update request before enabling the ime,
because we set the focus _after_ setting the cursor pos.

Fixes #2812
2023-06-05 14:55:22 +02:00
Simon Hausmann
0f54b9599b Add support for manually closing PopupWindows
This patch adds a `close()` function that can be called to close a popup
window, and a `close-to-click` boolean that can be set to false to
disable the default behavior.
2023-06-02 18:07:49 +02:00
Olivier Goffart
f7e61fdd37 Fix transparentize to multiply by 1-factor
Also add `[[nodicard]]` in C++
2023-06-02 17:02:08 +02:00
Olivier Goffart
5599bd44e0 Remove Color::opaque
It is not a right name and i don't think it is a so common operation
2023-06-02 17:02:08 +02:00
Olivier Goffart
cb4ef70d33 Fixup tests and and compilation with no_std
The interpolation now rounds the value, so the test needs to be adjusted
by one unit
2023-06-02 17:02:08 +02:00
Olivier Goffart
4845241ebf Rename translucent to transparentize and mixed to mix 2023-06-02 17:02:08 +02:00
Arthur Araruna
64ad1ce357 Add some color and brush manipulation funcs (#2565)
The added functions enable mixing colors and manipulating the opacity
of colors and brushes.

They enable the behavior of some of the available functions from SASS and are
added for future use for adding the Adwaita style (future PR).
2023-06-02 17:02:08 +02:00
Simon Hausmann
a8fcb5acd6 Fix delayed docs preview not working
After commit 7df902b53c, the winit window
is not created when calling show() anymore but it's now created at
component creation time.  That means the event loop workaround removed
in 459f810bd8 is now needed at
construction time.

Since this is a winit and wasm specific issue, it's now dealt with in
the wasm interpreter implementation, by invoking the creation from the
event loop from there and returning a promise in the API.

This changes the API therefore: create() can only be called after the
event loop is running.
2023-06-01 16:51:12 +02:00
Simon Hausmann
c428601370
Add support for select-all(), cut(), copy() and paste() functions on text input elements (#2804)
In the compiler this is still very primitive, but an attempt to start a
generic interface. The basic assumption is that all item functions will
eventually need access to the window adapter and itemrc. Support for
additional arguments is still missing.

Also missing is support for the function access via rtti in the
interpreter, hence the hardcoding at the moment.
2023-06-01 16:04:53 +02:00
Simon Hausmann
e7320607a3 Remove BorrowedOpenGLTexture from the public API again and just provide a factory function in slint::Image 2023-06-01 15:56:55 +02:00
Simon Hausmann
084ff70079 C++: Improve reliability of comparison operator of slint::Image
Call into the Rust implementation, so that we have to maintain only one
implementation.
2023-06-01 15:56:55 +02:00