Commit graph

10295 commits

Author SHA1 Message Date
Olivier Goffart
ca881ea5d9 Cell example: fix borrow panic
Fix panic when entering non numerical data in a cell

Fixes #4347
2024-01-16 18:04:27 +01:00
Florian Blasius
0a2147c6a8 Revert "Disable keyboard input on disabled ComboBox"
This reverts commit 33578d8898.
2024-01-16 15:21:55 +01:00
Florian Blasius
33578d8898 Disable keyboard input on disabled ComboBox 2024-01-16 15:18:07 +01:00
Florian Blasius
2cf2a36b1d Fix style issues on the cosmic style 2024-01-16 15:16:04 +01:00
Florian Blasius
1ca8ff517e
Added cosmic style for std-widgets. (#4350) 2024-01-16 13:21:17 +01:00
Tobias Hunger
192f805586 lsp: Find images not loading in native preview
I broke that when using URLs more consistently. Our path is either a
path or a URL is so easy to break.
2024-01-16 10:49:23 +01:00
Simon Hausmann
787a8d6bfb Node.js: Include napi generated module loader in npm package
That might help with build-on-demand.mjs trying to load it :)
2024-01-16 09:28:21 +01:00
Simon Hausmann
c9f11f7f72 Node.js: Add missing error argument to arrow function for debugging build-on-demand.mjs 2024-01-16 09:13:11 +01:00
Simon Hausmann
199c761583 LinuxKMS: Fix animations using the wrong start time when invoked from invoke_from_event_loop
The event loop roughly loops like this:

loop {
    update_timers_and_animations();
    render();
    sleep_or_dispatch_events();
}

sleep_or_dispatch_events() will wake up when we receive a queued callback from invoke_from_event_loop, and we would
run the callback right away. If that callback sets animated properties, the start time for animations would be incorrect, as we haven't called update_timers_and_animations() yet.

So instead, let's keep track of any received callbacks per sleep cycle, update the animation tick, and then invoke the callbacks.
2024-01-15 18:30:49 +01:00
Olivier Goffart
750a3033f8
C++ docs: add cmake reference 2024-01-15 17:36:29 +01:00
Simon Hausmann
8caa5acd30 winit: Avoid warnings about exiting fullscreen mode when compiled for the web
We call set_fullscreen(None) on startup for windows that aren't fullscreen (normally), and winit compiled for the web unconditionally calls canvas.exitFullscreen(), which
may produces warnings about exitFullscreen()
being called when not in fullscreen mode.
2024-01-15 15:22:15 +01:00
Simon Hausmann
732f9fa4ba Node.js: Add some debug output to the build-on-demand.js
Maybe this will tell us why it doesn't work.
2024-01-15 15:09:47 +01:00
Tobias Hunger
fe0ac9d6e8 FIX: lsp: Improve URL encoding 2024-01-15 14:46:39 +01:00
Tobias Hunger
e7ff4c196e lsp: Fix diagnostics in Preview UI
... when showing the UI around the actual preview.
2024-01-15 14:46:39 +01:00
Tobias Hunger
bb11166cde lsp: Show UI even if the first time preview rendering failed 2024-01-15 14:46:39 +01:00
Tobias Hunger
19cf90a319 lsp: Send document versions from lsp to previewer
We want the previewer to become interactive, so we need to pass on the
document versions so we can detect the editor, lsp and previewer going
out of sync.
2024-01-15 14:46:39 +01:00
Tobias Hunger
f93d1cbe33 lsp: Use new component information functions in code completion 2024-01-15 14:46:39 +01:00
Tobias Hunger
2ae760c8b9 lsp: Add helper functions to extract data on components
Add helper functions into a new `element_catalog` module that extract
information on components used in a piece of Slint code on the LSP side
of the LSP.

Eventually this information will be passed on to the Preview side and
can then be used there to show available components.
2024-01-15 14:46:39 +01:00
Tobias Hunger
77a97ed6b5 compiler: Export to_url from pathutils
The LSP will need this to unify code paths between WASM and binary
builds.
2024-01-15 14:46:39 +01:00
Update Translations Bot
ff2bf6849e Update Translations: extract strings 2024-01-13 03:03:53 +00:00
Simon Hausmann
9c247553e1 LinuxKMS: Tweak the output shown after SLINT_{DRM,VULKAN}_{MODE,OUTPUT,DISPLAY}=list to mention the environment variable in question
As suggested by Olivier, this makes it much clearer what the next steps
are.
2024-01-12 17:32:56 +01:00
Simon Hausmann
4d23bcdd97 LinuxKMS: Replace the use of panic with eprintln/std::process::exit
As suggested by Olivier, That's a little cleaner than panicing. There's
no reason to panic, this is normal :-)
2024-01-12 17:32:56 +01:00
Simon Hausmann
17a49cb22c doc: trim vulkan/drm mode list selection example and clarify the meaning of "output" 2024-01-12 17:32:56 +01:00
Simon Hausmann
2b699c2189 LinuxKMS: Add support for selecting display modes with DRM output 2024-01-12 17:32:56 +01:00
Simon Hausmann
bf7a4095ad LinuxKMS: Not only print the name of the renderer, also print the resolution 2024-01-12 16:07:29 +01:00
Laurent Montel
734ee0edc1 Allow to translate text. 2024-01-12 15:42:07 +01:00
Simon Hausmann
fef9c446a4
Fix missing invocation of init callbacks due to inlining (#4322)
When a component declares an init callback as well as the element that
instantiates it, the init callback of the container would not
get invoked if the container was inlined:

```
component InlinedContainer {
    init => { ... } // not invoked
    @children // force inlining
}

component UseSite {
    InlinedContainer {
        init => { ... }
    }
}
```

That's because the inlining happens very early, before the init
callbacks are collected into the init code. And during inlining that
would be treated like a property binding and the "binding" at the
element site overrides the one at the component site.

One natural approach would be to move the init code collection to an
earlier place before inlining, but that isn't possible because the
boundaries of the compiler components (Rc<Component>) aren't set
up yet (repeated component extraction phase happens much later).

An alternative would be to re-introduce the init callback code in
ElementRc and place it in there at *::from_node() time.

This patch chooses to solve this at the inlining time: When we're in the
first phase of the inlining (the optional one), do what
with the init binding what collect_init_code would do later: Move it
straight into the init_code of the component we're inlining into.

Fixes #4317
2024-01-12 10:14:27 +01:00
Simon Hausmann
4d58c9877d LinuxKMS: Remove set_event_loop_quit_on_last_window_closed implementation
This is now handled in i-slint-core.

Amends 9ff13faee8
2024-01-12 10:05:02 +01:00
Olivier Goffart
4a1a7b1f7e Fix slint warnings in the docs 2024-01-12 09:24:51 +01:00
Simon Hausmann
a3bb475500 Prospective build fix for no_std build with serde enabled 2024-01-11 18:02:51 +01:00
Olivier Goffart
638985612c Test purity of model expression 2024-01-11 15:13:01 +01:00
Olivier Goffart
a7934438ad Janitor: update some dependencies 2024-01-11 14:01:19 +01:00
Olivier Goffart
9111946a82
Introduce slint::run_event_loop_until_quit
Closes #1499
2024-01-11 13:52:02 +01:00
Simon Hausmann
e1c5f4ff03 linuxkms: Fix support for "refresh_full_speed" in SLINT_DEBUG_PERFORMANCE
We trigger update_timers_and_animations() every time the event loop wakes up.
If there's a real animation in the UI going on, that'll also trigger a
request_redraw() call and all will be well.

But when the only source of animation is set_has_active_animations() from
RenderingMetricsCollector, then we might end up in a situation where the event
loop is woken up before the rendered frame is on the screen, which means we
invoke update_timers_and_animations(), but we won't render because the
previous frame isn't shown yet. When it is shown and our presentation callback
is invoked, has_active_animations() is false again.

So instead, remember if we need to re-render once after rendering()
and use that to decide if we need to re-render in the presentation callback.
2024-01-11 11:23:18 +01:00
Zhiqiang Zhang
d7dd635408
add printerdemo for android (#4309) 2024-01-10 16:59:12 +01:00
Daniel
807a233849
feat: Add Key.Space to Key namespace. (#4311) 2024-01-10 16:25:31 +01:00
Tobias Hunger
9b7a9b3f77 lsp: Update selection code to changed double-click handling 2024-01-10 11:41:55 +01:00
Tobias Hunger
ad026d2a4c core: Change double-click to always send clicked first
Change the double-click implementation to send after two click events
were sent first.

This gets rid of the wait when a double-click handler is installed
before delivering the click.
2024-01-10 11:41:55 +01:00
Tobias Hunger
f2025ecf2d Test: Add explicit test for our time mocking infrastructure 2024-01-10 11:41:55 +01:00
Olivier Goffart
926c313493
Android docs: Fix warning in the documentation 2024-01-10 10:45:28 +01:00
Olivier Goffart
afb8a66603 Qt backend: Check if platform supports the selection clipboard
Suppress console warning on Windows:
`Data set on unsupported clipboard mode. QMimeData object will be
deleted.`

Fixes #3206
2024-01-10 10:11:05 +01:00
Olivier Goffart
0725bb1b61
Android docs: mention the todo example 2024-01-10 10:06:15 +01:00
Simon Hausmann
1ee410304a Add ChangeLog entry for fullscreen API 2024-01-09 18:55:28 +01:00
Simon Hausmann
29621043f7 Node.js: Add fullscreen setter for Window
Amends 779aff0b39
2024-01-09 18:55:28 +01:00
Simon Hausmann
438b9afeaa
Reduce WindowAdapter API slightly (#4304)
Move the set_fullscreen function added to the WindowAdapter trait in 779aff0b39
to be a function in WindowProperties instead.
That way it'll be easier in the future to extend this with other window states without
having to modify or break the WindowAdapter trait API.
2024-01-09 18:55:06 +01:00
Simon Hausmann
1ff1c68b20 Cleanup
Try installing the Android API level 30 without sudo, as
that appears to sometimes fail with

    sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper

Amends 2efd2bc3c8
2024-01-09 17:42:36 +01:00
Harold
779aff0b39
Added set_fullscreen API to WindowAdapter. (#4286)
See #3283
2024-01-09 15:23:23 +01:00
Simon Hausmann
2efd2bc3c8 Prospective fix for Android builds
In response to https://github.com/actions/runner-images/issues/8952
2024-01-09 12:19:06 +01:00
Tobias Hunger
9faffc75bb janitor: Fix warnings about unused members
I get warnings about unused members using the nightly compiler, one for
each member in all structs that derive the `FieldOffsets` macro. That is
a lot.

This fixes that as well as the one occurrence of that same warning in
unrelated code.
2024-01-09 10:48:19 +01:00
Update Translations Bot
5e9d352217 Update Translations: extract strings 2024-01-09 03:03:58 +00:00