The suggestions popup from the input method was off by the y-coordinate. This was due to
text_input_cursor_rect_for_byte_offset returning the y position of the line only.
However QTextLine::y() is relative to QTextLayout::position().y(),
which needs to be added to take any vertical alignment into account.
This comes with the same caveats as the winit one: The composition is
not committed when clicking with the mouse or generally aborting the
composition.
Known caveats:
- winit doesn't forward mouse events to the IME, so clicking
with the mouse while composing results in funny effects such
as the pre-edit text following the cursor.
- With FemtoVG there's no text decoration support, thus no underlining
of the preedit area.
* Add `RequestedSize` and `RequestedPosition` enum to enable asking for
logical or physical size/position.
* Rename `Window::size()` to `Window::physical_size()`
* Make `Window::set_size(...)` take an `Into<RequestedSize>`
* Rename `Window::position()` to `Window::physical_position()`
* Make `Window::set_position(...)` take an `Into<RequestedPosition>`
* Change `WindowAdapter` and related classes to be able to handle
requests being made in the either physical or logical units.
Implement this for C++, Rust and node.
We need to assign the width beofre computing the preferred height
otherwise zero or very small value can be assumed and it will case the
text engine return a huge preferred height.
Testcase:
```
export App := Window {
VerticalLayout {
padding: -10px;
Text {
text: "Lots of text with\nnewlines etc.\n lorem ipsum dolor sit amet";
wrap: word-wrap;
}
}
}
```
In particular, this fixes the gallery window size being too high when
using the skia renderer, because when given a zero width, skia return
a big size for the height, (contrary to the Qt backend that consider 0
as infinite, or the femtovg backend that will stop rendering once a line
can't fit)
Replaces #1621
and use Rc<dyn PlatformWindow> instead. The alias has to stay with the ffi
functions though and the item vtable definitions,
because we don't have an Rc<> template in C++.
Previously: Window is an Rc<WindowInner>, which has an Rc<dyn
PLatformWindow> - and weak references the other way around.
Now: Rc<dyn PlatformWindow> is the root of window ownership. The impl
PlatformWindow has a slint::api::Window, which just holds a WindowInner.
This change is incomplete on a few levels, mainly that neither of the
code generators nor the interpreter is ported.
For hide() we don't really need Rc<Self>, and for show() we had Rc<Self> because
for example for winit we need a Weak<Self> for the thread-local mapping of
window id to window.
However that can be encapsulated in the PlatformWindow impl using Rc::new_cyclic,
there's no need to expose this in the trait.
Move the self_weak of WindowInner into the impl of PlatformWindow. Most implementations already have it anyway.
While right now the method returns a `WindowRc`, at the end of the series
it should return a `&Window`.
From that `&Window` we can get to `&WindowInner` and all receivers there
are `&self`.
When the renderer does not re-implement visit_clip, we call combine_clip.
Then we're missing out on an optimization the GL renderer does: When the resulting clip region
is empty, we do not need to recurse into children for rendering.
That itself reduces the property dependency chain and avoids unnecessary
updates when invisible (clipped) children change properties.
This simplifies the renderer handling - the FontRequest arriving there
will always be resolved.
And this reduces the amount of property dependencies: If a Text elements
specifies a font-family, no dependency to the window's
default-font-family is created.
Every backend will do something different with the string that needs to go into the clipboard.
Qt will convert it to a QString, copypasta to a String, in theory it could be written
directly to a socket.
Given that we don't know what the perfect representation on the backend side is, passing
a string slice avoids any immediate conversions.
Instead of a new() function and a start() and no stop() function, create the collector
when we want to measure and drop it when we're done.
This will also make it possible to move the collector into the renderer
in the future.
This includes the cache of decoded images, the HTMLImage element support
and the SVG rendering adapter.
The objective is that Image holds an ImageInner, which is not a path
anymore that the backend has to process, but instead always either
decoded image data, a pointer to a static texture or an SVG tree that
can be rendered to the desired size.
The as_any() method returning a `&mut dyn Any` meant that the type has to be
'static. The class solution of returning &()
doesn't work because it has to be a mutable ref. Therefore just return an Option.
I want to track component structure changes in the window without
generating more code. So use a more generic name for the init_*_items
functions, so that I can add the functionality I need in there.
Also add a register_component to PlatformWindow and call that.
I want a more generic name as I want to do to track component structure
changes in addition to resource freeing and I do not want to add another
call into the generated code.