Commit graph

1507 commits

Author SHA1 Message Date
Simon Hausmann
3069e8e503 Add support for frame throttling on Wayland
Use winit's pre_present_notify() API to allow for the compositor to throttle rendering.

Fixes #4200
cc #1695
2024-01-04 09:21:53 +01:00
Olivier Goffart
c4a91982db Janitor: fix docs links 2024-01-03 16:29:03 +01:00
Simon Hausmann
d0616f31fb winit: Remove hack that makes request_redraw() during draw() work
Calling request_request() during RedrawRequested would not work on
Windows and wasm. Commit 372e6b0ffc worked
around this, but that can be reverted now, as this is fixed in winit.
For windows that was https://github.com/rust-windowing/winit/pull/3165
and for wasm I couldn't find the change, but could verify that it still
works.

I checked that #1574 does not regress.

Besides the cleanup, this is also needed for #1695.
2024-01-03 10:23:34 +01:00
Simon Hausmann
25579ab068 winit: Fix FocusScope's key-released not being invoked when releasing the space bar key
Upon pressing, event.text is set and all is well. But when the space bar is released, event.text is always
empty and we would not dispatch an event.
2024-01-02 15:29:24 +01:00
Simon Hausmann
6b6fd91035 linuxkms: Move the fallback timer based animation driver code into a separate helper type 2023-12-19 16:59:35 +01:00
Simon Hausmann
0b21d8bfce linuxkms: Don't use a 16ms timer for the animation frame callback after the first buffer was posted
We don't need to wait 16ms, we could render right away. In theory this could also use invoke_from_event_loop, but then
the callback needs to be sync, which is an unnecessary
complication.
2023-12-19 16:59:35 +01:00
Simon Hausmann
2d0f2a52e6 linuxkms: Simplify drm event handling code a little bit
Less code nesting :)
2023-12-19 16:59:35 +01:00
Simon Hausmann
0ccc334de7 linuxkms: remove home-grown fd event source with calloop's generic even source
That's less boiler plate for us and better error handling (note how the receive_events()
call on the DRM device now propagates the error). And this also unregisters automatically
on drop.
2023-12-19 16:59:35 +01:00
Simon Hausmann
208a1e24ac linuxkms: replace 16m timer for animations with page flip driven rendering (if possible) 2023-12-19 16:59:35 +01:00
Simon Hausmann
4f0ad4c15b linuxkms: remove page flip specific bits from the calloop event loop
This belongs encapsulated inside the egldisplay code.
2023-12-19 16:59:35 +01:00
Simon Hausmann
b998f94ad6 linuxkms: Avoid keeping the EGL display around for too long
Don't keep a strong reference to the EGL display, we don't need that. If the display is removed but there are pending events, just ignore them.
2023-12-19 16:59:35 +01:00
Simon Hausmann
388661cc53 linuxkms: Fix firing of timers while animations are running
Merge the 16 redraw timer with other timers, which might fire sooner.
2023-12-19 16:59:35 +01:00
Simon Hausmann
b40b629e11 linuxkms: don't blockingly read on the drm fd after issuing a page flip request
... instead pass the fd into the calloop event loop and change state when we receive activity on it.

This improves performance slightly, and is a necessary to be able to implement refresh rate throttled rendering (in the next commits).
2023-12-19 16:59:35 +01:00
Simon Hausmann
11df315c54 linuxkms: Clean up file descriptor handling (part 2)
File can be converted into OwnedFd, so we can replace the
use of a dyn with the concrete Rc<OwnedFd>.
2023-12-19 16:59:35 +01:00
Simon Hausmann
e98a029293 linuxkms: Clean up file descriptor handling (part 1)
We don't need Arc for the file descriptors that remain in the same thread.
2023-12-19 16:59:35 +01:00
Simon Hausmann
3b51c8e30a
LinuxKMS: Add support for synthetic display rotations (#4166)
This patch adds support for the `SLINT_KMS_ROTATION` environment
variable, that instructs the Skia/FemtoVG renderers to rotate
the scene before rendering.
2023-12-18 17:49:05 +01:00
Simon Hausmann
007de3dd8d Use raw-window-handle 0.6 for accesskit
The new release defaults to using rwh 0.6, which implicitly also
enables rhw_06 on winit.
2023-12-18 17:07:30 +01:00
Noah Sweilem
4ca5afc710
Implement colorize-icon for NativeButton (#4167)
Fixes #4159.

Co-authored-by: Florian Blasius <florian.blasius@slint.dev>
2023-12-18 09:19:09 +01:00
Noah Sweilem
1ddddf1081
Qt backend: use QObject::deleteLater() when destroying popup QWidget (#4168) 2023-12-18 09:03:39 +01:00
Florian Blasius
e587c09d9c
Added colorize-icon to Button (#4152)
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2023-12-14 12:07:55 +01:00
Simon Hausmann
8d19426723
linuxkms: decouple event loop from window adapter (#4144)
- Allow for the event loop to run before creating the window adapter
- Keep the loop running if requested
2023-12-12 13:06:36 +01:00
Simon Hausmann
c1841fdfbe Add support for compiling the linuxkms backend without libseat support 2023-12-11 17:36:17 +01:00
Florian Blasius
6da8120dfa
added palette global (#3984)
* Update docs/reference/src/language/builtins/globals.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update docs/reference/src/language/builtins/globals.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update docs/reference/src/language/builtins/globals.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update docs/reference/src/language/builtins/globals.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update docs/reference/src/language/builtins/globals.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>


---------

Co-authored-by: Florian Blasius <florian.blasius@slint-ui.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
Co-authored-by: Florian Blasius <flovansl@fedora.fritz.box>
2023-12-11 14:44:05 +00:00
Tobias Hunger
2bdcbc8e9f
core: Add a double-click callback to the TouchArea (#4060)
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2023-12-08 12:12:41 +01:00
Florian Blasius
6d6b18300a
added focus state to StandardLIstView (#4086)
* added focus state to StandardLIstView

* (wip) focus handling for qt style

* Update CHANGELOG.md

Co-authored-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>

* Share StandardListView between all styles

* Update internal/compiler/widgets/material-base/combobox.slint

Co-authored-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>

* code review feedback

---------

Co-authored-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
2023-12-08 10:58:58 +01:00
Tobias Hunger
3a87342073 testing: Add a method to the testing interface to query the mocked time
I find this helpful when debugging tests using mocked time.
2023-12-01 17:36:18 +01:00
Simon Hausmann
19f6840452 Remove now unused Qt license files 2023-12-01 14:48:07 +01:00
Horbin
9a1857fb36
Fix the window doesn't automatically resize. (#4032)
Try to fix the issue #3911.

In 1.3.0, the function "adjust_window_size_to_satisfy_constraints" is deleted.
I guess that, in Winit 0.29.x, the window will automatically resize, but, at least, it doesn't work on Windows.
So, I try to add this function back.
2023-11-29 21:04:12 +01:00
Jocelyn Turcotte
82916bc2ec Implement KeyEvent.repeat
Now that winit was upgraded do 0.29 we can use its KeyEvent::repeat field.
Also feed Qt's QKeyEvent::isAutoRepeat() in the Qt backend.
2023-11-29 09:31:31 +01:00
Olivier Goffart
8a841405c8 Revert "Fix timers not firing on Windows"
This reverts commit 1f5f07f65a.

Revert the work around that is no longer required with 0.29.4
(also add this version as a dependency)
2023-11-27 16:39:01 +01:00
Olivier Goffart
a266e63549 Testing: Add some tests for setting the mouse cursor 2023-11-23 07:25:46 +01:00
Simon Hausmann
cb51fdfe81 janitor: bump xkbcommon dependency 2023-11-14 16:00:56 +01:00
Simon Hausmann
269b327cff janitor: bump calloop dependency 2023-11-14 15:56:24 +01:00
Simon Hausmann
d68b981a16 Upate cocoa dependency
cc #3922
2023-11-14 19:23:32 +08:00
Simon Hausmann
58f9cf5d36 Port to new vulkano
This might fix the issue with resizing causing swapchain re-creation
errors, because "Swapchain creation no longer returns an error when the
swapchain extent doesn't match the current surface extent."

cc #3850
2023-11-13 12:39:59 +01:00
Simon Hausmann
0118363bec Fix build with only backend-linuxkms
Activate the kms feature of softbuffer correctly, when building without
default features.
2023-11-13 11:14:03 +01:00
Olivier Goffart
0b70cbc9a9 Don't use workspace deps for dev-dependencies
They can't have version otherwise we can't upload to crates.io
2023-11-10 11:03:10 +01:00
Olivier Goffart
1f5f07f65a Fix timers not firing on Windows
On Windows, winit doesn't respect the set_control_flow from the
AboutToWait event.
This is a bug in winit, but we can easily work it around

Fix #3875
2023-11-08 22:10:24 +01:00
Olivier Goffart
8fe1dd9ff8 winit: WindowAdapter::set_visible shouldn't do anything if it is already in that state
calling show() on a visible window or hide() on a hidden window
shouldn't do anything.
Especially currently it would resize to the preferred size.
So that makes the preview UI to alsways resize to the preferred size
because we always call show()
2023-11-08 16:06:12 +01:00
Simon Hausmann
a5c3692fbc Add progress-indicator accessible role 2023-11-07 13:37:12 +01:00
Simon Hausmann
7b61e455eb Initial implementation of a Slint event loop sitting on top of Node.js
At the moment this is implemented using polling.

cc #2477
2023-11-06 11:37:45 +01:00
Simon Hausmann
ee9f1a52a8 winit: Make it possible to resume the event loop while maintaining state
This way if for example the application quits the event loop while
pressed is true, and then resumes shortly afterwards, we maintain the
pressed state correctly.
2023-11-06 11:37:45 +01:00
Simon Hausmann
3a9288003d
Re-enable accesskit (#3833)
Port to the latest accesskit and accesskit_winit:

- NodeId is now a u64 instead of u128, so trim the component/item encoding.
- Adjust to some enum renamings.
- TreeUpdate now always requires a focus node, which we set to the root.
- Fixed focus handling on macOS: Report FocusIn to the accesskit
  adapter, so that it can update its internal host_is_focused state
  correctly.
2023-11-05 09:04:05 +01:00
Olivier Goffart
19954d39ac Call set_resizable before setting the constraints
Not sure why, but it fixes that applying the constraints is otherwise
not working with winit on X11

This is not the first time we do this fix:
723f89d342 and 1891e4489a
2023-11-03 18:51:49 +01:00
Simon Hausmann
ed570053a9 Fix copy & paste in wasm builds
Commit f24014a2dd made the insert function
private. Let's solve this differently by creating a private WASM
clipboard and invoking copy() and paste() on the Text item instead.

The first attempt was implementing a ClipboardProvider just for the wasm
build, just like with SilentClipboard, but unfortunately that doesn't
work because in the backend's set_clipboard_text()/clipboard_text()
functions, there's no currently running winit event loop that we could
access, becaused the call stack starts directly at the DOM event
handler, not in our winit event handler.
2023-11-03 17:36:58 +01:00
Simon Hausmann
bc14ce66c2 Fix resizing of windows on Wayland
On wayland, we may not be getting a resize event, after issuing `request_inner_size()`.
Without that, we would fail to size the EGL surface correctly.

Centralize all request_inner_size() call sites
and dispatch a "local" resize event if the new size is returned by winit.

Fixes #1671
2023-11-03 16:33:21 +01:00
Olivier Goffart
f03507ee6a Fix CI build: intra links don't work on non-android in the android backend 2023-11-02 17:53:57 +01:00
Olivier Goffart
45d6cd1f7f
Android: add readme for the backend (#3836)
To serve as docs while the backend is still internal

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2023-11-02 17:17:06 +01:00
Olivier Goffart
5f36eaca9a Android: handle InputEvent::TextEvent 2023-11-02 12:16:40 +01:00
Olivier Goffart
de86c6049c Adapt wasm to the latest changes 2023-11-02 12:16:40 +01:00