Commit graph

158 commits

Author SHA1 Message Date
Olivier Goffart
fde561a56a Some improvements to Window visibility
- From C++, always call the Window::show() and hide() function instead
   of going through set_visible directly as it doesn't set the size of
   the WindowItem
 - show() should also call resize on the renderer
 - remove the is_visible in the WindowAdapterInternal as it is no longer
   needed
2023-08-30 13:05:35 +02:00
Simon Hausmann
d160eb7a31
Add support for set_position(), position(), and set_physical_size() to the C++ WindowAdapter (#3367)
Closes #3349
2023-08-28 18:43:04 +02:00
Simon Hausmann
ce07a3ab74 Fix doc warning 2023-08-28 15:08:47 +02:00
Simon Hausmann
11128b3b7f Document show()/hide()'s behavior of the additional strong component reference 2023-08-28 13:45:28 +02:00
Olivier Goffart
7904493e1c C++: dispatch close request and activation change 2023-08-24 17:27:04 +02:00
Olivier Goffart
c33e5a0f12
Rust platform API: add ways to send CloseRequested and WindowActiveChanged events 2023-08-24 14:39:20 +02:00
Olivier Goffart
fadedad025 Prospective fix for warnings in nightly 2023-08-21 13:02:58 +02:00
Simon Hausmann
f2af8317a2 doc: Give visibility to slint::Window::new() 2023-07-27 16:50:29 +02:00
Simon Hausmann
3b29bfe2f6 Change OpenGLContextWrapper to return a generic Error
This is in preparation for making the trait public.
2023-07-27 16:48:57 +02:00
Simon Hausmann
581085a953 Added PlatformError::OtherError that stores a boxed error
This allows our public traits to return a boxed error.
2023-07-27 16:48:57 +02:00
Olivier Goffart
d43d24ec7e Un-hide the renderer() function from the WindowAdapter
Now that the SoftwareRenderer can be constructed, it is
finally possible to have your own WindowAdapter

Revert "Hide the `renderer()` function from the public API"

This reverts commit ff6653c77e.
2023-07-27 14:44:28 +02:00
Tobias Hunger
731c422329 Add a ComponentFactory (Rust)
Add a ComponentFactory type which will eventually be used as a property
value in Slint. The idea is to copy around this type and to create
components from it that we can embed.

We do not want to hand raw components around as those are reference counted
and might end up being embedded into several places, which would break out
tree of components.
2023-07-27 12:04:16 +02:00
Simon Hausmann
f15bc6147e Simplify FemtoVG and Skia renderer APIs: remove resize()
We can convey the new physical window size from the run-time
through the private renderer API
when a window resize event is dispatched.
2023-07-25 19:33:26 +02:00
Guilhem Vallat
8f2fd38a88 Implement Default for Weak 2023-07-17 20:05:36 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Guilhem Vallat
023d5a041d remove clippy::wrong_self_convention warnings 2023-06-30 12:28:13 +02:00
Tobias Hunger
e02c360000 Clippy polish 2023-06-28 14:22:30 +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
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +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
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
Olivier Goffart
5f84cd5a90 Change the return type of WindowAdapterSealed::position to be an Option 2023-06-12 19:25:33 +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
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
Olivier Goffart
dd5ef9993f
Platform: Add a Resized event and use that to convey the changes in size (#2759) 2023-05-21 12:12:30 +02:00
Simon Hausmann
846c48b81d Add public API to allow platforms to report the window scale factor
Add WindowEvent::ScaleFactorChanged and made set_scale_factor on
WindowInner private.

This achieves what #2486 tried to do, but using the clean platform
window event interface.
2023-05-19 17:06:38 +02:00
Olivier Goffart
a68df6eb70
WindowAdaptor: change the 3 ime call into one single ime request enum (#2747) 2023-05-17 17:50:19 +02:00
Simon Hausmann
2cb0b2233a Attempt at making the C/C++ ABI more robust
Add explicit enum values for repr(C) enums that have attributes like
cfg, so that even if there's a cfg gap in an enum (say cfg(feature =
"svg")) it won't break the ABI.

See also 004dce6c0b
2023-04-14 14:57:47 +02:00
Olivier Goffart
fd3f974d7e Don't use old syntax in docs 2023-04-06 17:06:46 +02:00
Olivier Goffart
16fbee01fe Allow slint::Weak::upgrade_in_event_loop in no_std
Closes #2379
2023-03-28 12:46:32 +02:00
Simon Hausmann
8ffb5131c7
Introduce error handling in the FemtoVG and Skia renderers (#2402)
Avoid unwrap() and expect() and instead propagate errors all the way
down to run_event_loop(), show(), and hide() in the Slint AIP.
2023-03-24 14:18:11 +01:00
Tobias Hunger
799c9a9389
docs: fix some more links from rust docs into other docs 2023-03-24 10:18:04 +01:00
Tobias Hunger
a50983862b
docs: Fix some more broken links 2023-02-23 11:31:39 +01:00
Tobias Hunger
39d215bee0 docs: Rename "Slint language Reference" to "Slint Language Documentation" 2023-02-22 21:13:47 +01:00
Tobias Hunger
78892cdf1f docs: Fix broken links in our docs. 2023-02-22 17:08:30 +01:00
Olivier Goffart
6889dfa5f5 Rust: Make new(), run() and show() report errors from the backend
Fixes #2198
2023-02-10 05:00:03 +01:00
Florian Blasius
d84de623b4
TextEdit select text with double and dribble click (#2088)
* Select word in `TextEdit` by double click
* Select paragraph in `TextEdit` by dribble click
2023-01-31 15:04:19 +01:00
Simon Hausmann
52fb1ab9fe Fix signature of get_proc_address in Rust GraphicsAPI
Use a CStr instead of str, to avoid an extra CString allocation. The underlying operating system API for
this expects a zero terminated C String.

Fixes #1943
2023-01-26 11:55:10 +01:00
Simon Hausmann
7122d22c88 janitor: use the new default attribute for enums 2022-12-05 10:20:39 +01:00
Simon Hausmann
247772104a Move WindowEvent, PointerEventButton and Key to the platform module
For `Key` this is a move, as it is a new type. For `WindowEvent` and `PointerEventButton` deprecated aliases
are provided.
2022-11-24 11:34:28 +01:00
Simon Hausmann
66871da47b doc: remove stray triple slash 2022-11-24 09:15:05 +01:00
Florian Blasius
61c39b5fa1 Add support for dispatching key events through the public platform API
This change adds `KeyPress` and `KeyRelease` variants to the
`WindowEvent` enum, along with the new `slint::Key` enum, that allows
encoding keys.
2022-11-15 10:34:17 +01:00
Simon Hausmann
e9db914fb1
Add is_visible to NodeJS and C++ Window types (#1816)
Amends commit 82278a5742
2022-11-04 16:24:24 +01:00