Commit graph

1507 commits

Author SHA1 Message Date
Simon Hausmann
cadfd9e104 Testing: Fix querying for elements by id when using _
The compiler normalizes `the_element` to `the-element`, so we also need to normalize that behind our API.
2024-08-05 10:32:21 +02:00
Simon Hausmann
d3aa425682 Fix build with [ "backend-linuxkms-noseat", "renderer-skia-opengl", "gettext", "compat-1-2" ], default-features = false }
Test for `renderer-skia-opengl` as `renderer-skia` enables the former.
2024-07-30 13:39:25 +02:00
Simon Hausmann
9bef3e47f4 Fix GBM rendering on mali EGL drivers
Combining an EGL config with EGL_ALPHA_SIZE == 8 with an Xrgb8888 surface yields a bad match on eglCreateWindowSurface.
That's fair, and we should accomodate for that by avoiding such EGL configs.
2024-07-30 13:04:48 +02:00
Simon Hausmann
11ce002314 macOS: Fix windows not resizing/redrawing correctly when showing again after calling hide
Don't assume that any pending redraw request will be delivered when the window his shown/hidden.

Amends 9113b877bd

Fixes #5658
2024-07-23 13:35:35 +02:00
Olivier Goffart
8eb1543832 Android: create output directory for .class
According to https://github.com/slint-ui/slint/discussions/5662 , this might be necessary
2024-07-22 15:23:46 +02:00
Simon Hausmann
28f7ee7c7d winit: Prefer X11 over Wayland when running in WSL
This is a workaround for the compositor on WSL tending to crash.
Unfortunately we can't just try to create an event loop with x11 first
and then re-try with wayland, winit doesn't allow that. So just avoid
wayland for now.

The long term solution #5667

Fixes #5657
2024-07-22 14:12:14 +02:00
Simon Hausmann
7536a6df06 Attempt to fix testing publishing 2024-07-18 12:11:21 +02:00
Simon Hausmann
592ecc2f08 Permit publishing of testing crate 2024-07-18 12:06:35 +02:00
Simon Hausmann
9e8fccb742 system testing: Add support for dispatching pointer and key window events 2024-07-16 14:10:22 +02:00
Simon Hausmann
52f8249189 testing: Minor rename after a quick round of API review
- ElementHandle::match_descendants() becomes ElementHandle::query_descendants() to emphasize that this creates a query.
- Added ElementQuery::from_root() to remove the need to use the ElementRoot trait.
2024-07-15 11:30:34 +02:00
Simon Hausmann
790ae9c1bb Remove last use of ElementHandle::visit_elements from Rust testing API 2024-07-15 11:30:34 +02:00
Simon Hausmann
1c2a8f2d2f Replace uses of ElementHandle::visit_elements with matches 2024-07-15 11:30:34 +02:00
Simon Hausmann
b67fcce4a3 Add a new descendants api as well as deeper element queries to ElementHandle 2024-07-15 11:30:34 +02:00
Olivier Goffart
b9dc73bc6a Android: Print a warning when there is an error from the build script JDK 21
It doesn't compile:
```
Dex conversion failed: Error in ...\out\java\dev\slint\android-activity\SlintAndroidJavaHelper$1.class:
java.lang.NullPointerException: Cannot invoke "String.length()" because "" is null
```

I don't know how to solve the error, but i can giv an informative
message telling them to downgrade Java

CC: #4973
2024-07-11 13:30:13 +02:00
Simon Hausmann
0be2d4521e API Review: Remove suspend/resume related functions from FemtoVG renderer
This could've been `set_opengl_context` taking an `Option`, but it turns
out that makes for an awkward interface when wanting to pass None,
because that also then requires a dummy type for the OpenGL context even
though none is wanted.
2024-07-08 12:23:56 +02:00
Simon Hausmann
877bf786b8 Add support for RGB565 linux framebuffer rendering 2024-07-08 11:55:57 +02:00
Simon Hausmann
a16e86bbd9 API review: Remove accidental public strum dependency
Deriving strum::EnumIter on a publicly exposed enum (like PointerEventButton) implies visibility into types that strum declares. This was added just for testing
in systest and can be solved differently.

Amends a1857e6154
2024-07-05 20:48:25 +02:00
Simon Hausmann
89b80eb00e API review: move {window,display}_handle_06_rc() into WindowAdapterInternal 2024-07-05 20:48:02 +02:00
Simon Hausmann
e35d05f6b9 API Review: Remove SharedImageBuffer from public API and rename Window::grab_window() to take_snapshot()
Use SharedPixelBuffer as return value for take_snapshot() and provide counter-parts to from_rgb* in Image as to_rgb*
2024-07-05 20:46:55 +02:00
Olivier Goffart
8b5df70dd0 Make a trait for the Text rendering
So we can Split Text
2024-07-05 12:51:25 +02:00
Olivier Goffart
7c93c7438b Rename resize-border => resize-border-width 2024-07-05 12:50:16 +02:00
Noah Sweilem
6095398374
Winit window event filter (#5531)
* Add winit window event filter (#3066)

* Winit window event filter changelog entry

* Format fixes

* More format fixes

* Make requested changes

- Callback gets a ref to the Slint window
- Callback returns an enum
- Callback is no longer `Send`

* Format fixes

* More format fixes

* Merge conflict fixes

* Rename members of `WinitWindowEventResult`

Closes #3066
2024-07-04 17:41:57 +02:00
Simon Hausmann
1ab68d53ed winit: remove unnecessary helper function to access winit window 2024-07-03 18:01:48 +02:00
Simon Hausmann
cc1038baf8 Oops, fix non-wasm build 2024-07-03 16:06:47 +02:00
Simon Hausmann
c1e1a81b93 Fix some wasm build warnings 2024-07-03 15:46:28 +02:00
Simon Hausmann
38bc37f72a Add missing dispatch of resize event to the window item when the user resizes the window while being hidden 2024-07-03 14:22:30 +02:00
Simon Hausmann
dd49ecacf3 Make an effort to avoid returning None from WindowAdapter::position() when we have no native window
When the user queries the physical position of the window after setting a logical position, but we don't have a window, use the last known scale factor.
2024-07-03 14:22:30 +02:00
Simon Hausmann
8c1ee12f84 Remove outdated comment
The new enum keeps the winit::window in an Rc (and we did before as well).
2024-07-03 14:22:30 +02:00
Simon Hausmann
a75b9fe643 Clean up WinitWindowAdapter construction
Call resume() on the renderer in one place, instead of several.

Co-Authored-By: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-Authored-By: Olivier Goffart <olivier.goffart@slint.dev>
2024-07-03 14:22:30 +02:00
Simon Hausmann
49df131625 Fix slint::Window::hide() on Wayland with winit
On Wayland hiding a window requires destroying the surface, which
means destroying the winit window as well as the underlying graphics
surface. The latter is tricky as we have to keep the renderer around,
as our WindowAdapter trait's `renderer()` function returns a `&dyn
Renderer` and that also has to work without a window (to obtain text
metrics).

Fixes #4225

Co-Authored-By: Olivier Goffart <olivier.goffart@slint.dev>
2024-07-03 14:22:30 +02:00
Simon Hausmann
862b1e1dfe winit software: remove unneccessary winit_window rc field
We can obtain that from the softbuffer surface.
2024-07-03 14:22:30 +02:00
Simon Hausmann
5afb9768c5
Fix crash on app shutdown on Wayland (#5534)
Valgrind would report invalid reads on the wayland clipboard shutdown code, suggesting that the wayland
display has already been destroyed.

Since the display handle isn't refcounted, we must make sure that the wayland clipboard is around as long as the wayland display handle, provided by the winit event loop.
2024-07-03 13:05:06 +02:00
Olivier Goffart
60569673b5 Remove some cargo:rustc-check-cfg output:
- The cfg_aliases crate does it out of the box already
 - Don't create a build.rs for this only purpose when it can be added in
   Cargo.toml lints group. (This wasn't possible when the warning was
   first introduced in nightly)
2024-07-02 13:33:48 +02:00
Olivier Goffart
161a734805 Qt: fix unexpected_cfgs warning
We didn't emit the directive for all features
2024-07-02 11:50:27 +02:00
Olivier Goffart
1baf227e9e Update AccessKit 2024-07-02 11:45:46 +02:00
Simon Hausmann
0aaf5b57ab Fix formatting 2024-07-02 09:23:09 +02:00
Simon Hausmann
a24c04fd84 linuxkms: Fix build with just renderer-skia
That one also falls back to software and when used with linuxfb needs
the timer based animation driver.
2024-07-02 08:50:42 +02:00
Simon Hausmann
6d14f5ca15 Fix unused type warnings in i-slint-backend-linukxms build with default features
When no features are enabled, the TimerBasedAnimationDriver would be unused.
2024-07-01 11:33:46 +02:00
Tobias Hunger
dbde3c2f9e janitor: Remove unused variable warning in winit 2024-06-28 18:59:01 +02:00
Simon Hausmann
fd8bc22b40 Fix rustdoc warning about link to non-existent function 2024-06-28 15:33:59 +02:00
Simon Hausmann
bf919d300d Work around sometimes missing resize event on macOS with winit
Fixes #5509
2024-06-28 15:26:36 +02:00
Simon Hausmann
7f05b8aa39 Changed ElementHandle click API to a single_click and double_click function taking the button
That way one can also simulate double right click, for example. This is a little less convenient, more generic, but a reasonable compromise (perhaps :-)
2024-06-28 13:56:51 +02:00
Simon Hausmann
e78e68a1ba System Testing: Add support for clicking on elements 2024-06-28 13:56:51 +02:00
Simon Hausmann
b45945a234
Add support for async unit testing and element handle click events (#5499)
This patch adds async click functions to ElementHandle and adds timer support to the testing backend's event loop.
2024-06-27 17:05:58 +02:00
Olivier Goffart
f4085cfd13 winit: Fix setting the size with set_size before showing the window
Fixes #5489

We shouldn't resize the window to the size of the WindowItem after
start. This happens when set_size is called before show. The the
resize event didn't yet propagate the size to the WindowItem properties.
2024-06-27 16:12:35 +02:00
Simon Hausmann
155156aab9 System testing: Add support for grabbing window contents as PNG encoded image 2024-06-27 10:25:03 +02:00
Arnold Loubriat
ce2db77e88
Add the accessible-placeholder-text property (#5464) 2024-06-26 12:59:22 +02:00
Tobias Hunger
87e4cb8951 janitor: Fix warning about unused import 2024-06-24 14:59:47 +02:00
Tobias Hunger
cd3b60c889 janitor: Fix clippy "creates a reference which is immediately dereferenced" 2024-06-24 14:59:47 +02:00
Simon Hausmann
d86ae620b4 Add a very basic and crude implementation for software rendering to the legacy Linux framebuffer interface
This assumes the same xrgb888 interface that the drm dumb buffer uses, too. Missing, beyond different pixel depths is:

 - mode setting (requires fbset on the command line right now)
 - vsync (not sure if possible)
 - line padding
2024-06-22 09:37:34 +02:00