Commit graph

213 commits

Author SHA1 Message Date
Simon Hausmann
e9db914fb1
Add is_visible to NodeJS and C++ Window types (#1816)
Amends commit 82278a5742
2022-11-04 16:24:24 +01:00
ogoffart
2171773a3e Bump version number to 0.3.2 2022-10-28 09:30:14 +00:00
Simon Hausmann
37a8c50c12 Simplify FontRequest
It doesn't have to be generic as mostly the frontend code creates it with logical lengths.
2022-09-30 23:31:32 +02:00
Simon Hausmann
a52d633b59 Change FontRequest to be a generic over the length
The API uses a logical length for pixel sizes and letter spacing,
but the renderer will need the physical length eventually.
2022-09-30 13:00:37 +02:00
Simon Hausmann
1624a66ebc Change the Renderer trait's text related functions to explicitly operate on logical lengths 2022-09-30 13:00:37 +02:00
ogoffart
261614b914 Bump version number to 0.3.1 2022-09-15 14:39:51 +02:00
Simon Hausmann
dba137e3ba
Rename RequestedSize to WindowSize and RequestedPosition to WindowPosition (#1640) 2022-09-14 12:59:53 +02:00
Tobias Hunger
53a3c72b57
api: Change logical/physical position and size on window (#1620)
* 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.
2022-09-13 08:55:31 +02:00
Olivier Goffart
88d231f3ec Move the testing module from away from public api
move it the testing backend
2022-09-06 17:27:15 +02:00
ogoffart
05a49da906 Bump version number to 0.3.0 2022-09-06 13:00:22 +02:00
Simon Hausmann
7e5de3d5d3 Remove use of euclid types and tags for logical/physical position and size in the public API
Instead provide our own types.
2022-09-02 11:05:53 +02:00
Simon Hausmann
85461d380d Remove euclid from the public re-export of the Slint crate 2022-09-02 11:05:53 +02:00
Olivier Goffart
b9c2dec922 API: seal the WindowAdaptor trait
And hide most of its functions in the sealed trait.
2022-08-30 22:21:24 +02:00
Tobias Hunger
88cf874d03 API cleanup: Rename create_window to create_window_adapter 2022-08-29 16:53:47 +02:00
Tobias Hunger
1e6ffeaa0f API cleanup: Rename PlatformWindow to WindowAdapter 2022-08-29 16:53:47 +02:00
Tobias Hunger
53053683a1 API cleanup: Rename PlatformAbstraction to Platform 2022-08-29 13:26:36 +02:00
Tobias Hunger
13701b4b3f API cleanup: Rename set_paltrom_abstraction to set_platform 2022-08-29 13:26:36 +02:00
Olivier Goffart
7417422e3c Make the PlatformAbstraction not Send using a EventLoopProxy trait
This changes the way the platform abstraction is initialized
2022-08-24 11:32:21 +02:00
Olivier Goffart
2e5ab86bea Rename backend module to platform
and the Backend trait into PlatfromAbstraction trait
2022-08-23 19:39:49 +02:00
Simon Hausmann
1d436778c1 Remove the use of the PlatformWindowRc alias again
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++.
2022-08-19 15:07:27 +02:00
Simon Hausmann
af86f36157 Invert slint:🪟:WindowInner and PlatformWindow ownership
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.
2022-08-19 15:07:27 +02:00
Simon Hausmann
f88b688fbf Simplify PlatformWindow receivers
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.
2022-08-19 15:07:27 +02:00
Simon Hausmann
8e84faa2c5 Prepare PlatformWindow API for exposing and (in the future) owning the Window
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`.
2022-08-19 15:07:27 +02:00
Olivier Goffart
02c60e5389 Refactor the way the backend sets the window size 2022-08-18 09:39:25 +02:00
Olivier Goffart
8c70cd7f57
Move the fonts out of the Backend trait (#1438)
and remove the `'static`
2022-07-26 16:45:54 +02:00
Simon Hausmann
369f347b29 Move the clipboard back from the Window to the Backend trait
Found a way to connect the clipboard to the wayland display through the winit event loop target.
2022-07-25 15:41:51 +02:00
Olivier Goffart
8287ed4b9e Some more simplifications of the PlatformWindow and Backend trait 2022-07-25 14:51:03 +02:00
Olivier Goffart
74c041010e Move the text functions out of the Window, into the Renderer trait 2022-07-25 12:04:34 +02:00
Olivier Goffart
29404e3f2c Rename i_slint_core:🪟:Window into WindowInner
We already have `api::Window` and also the Window element (`WindowItem`),
So rename the inner part to avoid confusion
2022-07-22 18:12:00 +02:00
Simon Hausmann
c494861ddd Change set_clipboard_set to take a &str instead of a String
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.
2022-07-22 15:21:21 +02:00
Simon Hausmann
8a3ff06eb5 Move the clipboard handling from the Backend trait into PlatformWindow
Access to the clipboard implies access to the windowing system.
2022-07-22 08:10:44 +02:00
Olivier Goffart
7ccd36f7f2 Simplify PopupWindow handling
When the popup is implemented as an overlay on the window, no need
for the backend to do anything
2022-07-21 12:36:53 +02:00
Simon Hausmann
67a2f0ce3f WIP: Make image decoding a feature of the core library
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.
2022-07-20 12:57:37 +02:00
Simon Hausmann
937c37677e Add API for setting and getting the size of a Window in Rust and C++ 2022-07-08 18:37:01 +02:00
Simon Hausmann
3ce9977f0a Add slint::Window::(set_)position
Fixes #323
2022-07-08 18:37:01 +02:00
ogoffart
6b15d2e479 Bump version number to 0.2.6 2022-07-06 09:58:14 +00:00
Tobias Hunger
dd59d41ee6 Rename init_*_items to register_component
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.
2022-06-30 11:51:49 +02:00
Tobias Hunger
581533f302 Rename free_*_graphics_resources to unregister_component
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.
2022-06-30 11:51:49 +02:00
Olivier Goffart
fa6be65a04 Revert "Rename the free_graphics_resources to component_destroyed"
This reverts commit 1b9fee96c16f7a660ed2c14bb3287fceedc72ba7.

The MCU backend still need the array of item, so it's too realy for this change
2022-05-31 10:48:24 +02:00
Olivier Goffart
ad2d19165a Rename the free_graphics_resources to component_destroyed
And do not iterate over the items anymore
2022-05-31 10:48:24 +02:00
Olivier Goffart
615c7635ee Qt: use a HashMap for the cache
And not the cache dirrectly within the item, because it is already in use
for the partial rendering
2022-05-31 10:48:24 +02:00
ogoffart
3709ded44d Bump version number to 0.2.5 2022-05-09 16:16:00 +00:00
ogoffart
c160ec2aef Bump version number to 0.2.4 2022-05-09 13:49:25 +00:00
ogoffart
6395cdfc09 Bump version number to 0.2.3 2022-05-04 12:32:58 +00:00
Lukas Jung
b6171530ab replace text_input_position_for_byte_offset with text_input_cursor_rect_for_byte_offset 2022-03-28 10:07:07 +02:00
ogoffart
7b50791db4 Bump version number to 0.2.2 2022-03-10 08:48:33 +00:00
Simon Hausmann
f1dae75d53 Fix interpreter ffi build
Commit 738ac0dc01 increased the size of the ImageInner::StaticTextures variant,
which breaks the size assertions in the interpreter ffi build.

This changes fixes that by reducing the size of the ImageInner variant again by
moving all the fields into a separate struct.
2022-03-03 14:04:45 +01:00
Simon Hausmann
738ac0dc01 mcu: scale images at compile time (#966)
Apply a scale factor to reduce the size of embedded images at compile
time.
2022-03-03 13:28:47 +01:00
Olivier Goffart
c954ebf861 Test: enable the jpeg feature on the image crate
Since the cat picture is now in jpeg, we need to be able to decaode it
from the tests.
Luckily on the CI this works fine beacause we do a full cargo test that
build all the crates including the gl crate that has the jpeg format enaabled,
but if we try to compile the test with limited feature set, it wouldn't be available.
2022-02-15 15:12:13 +01:00
Olivier Goffart
efd6c63b8e Fix animation in the flickable
This is a regression since the introduciton of iteration_count which defaults
to 0 for animation started programatically

Also add a test.

Fix #951
2022-02-15 12:02:27 +01:00