Commit graph

249 commits

Author SHA1 Message Date
Olivier Goffart
4cc6337c42 Rust: Don't get the default font size through the root component
Planning for multi-component support
2024-06-13 13:53:07 +02:00
Simon Hausmann
4591ad8d57 Add plumbing for system testing 2024-06-13 04:03:17 -07:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Olivier Goffart
cadcd4caf4 Change callback: rust code generation 2024-05-02 22:25:53 +02:00
Olivier Goffart
5e634fda9f PropertyTracker: Pin the DirtyHandler 2024-05-02 22:25:53 +02:00
Olivier Goffart
f45bab6a3f swrenderer: Support multiple rectangles for the dirty regions
This allow to be much faster in the case two small area of the screen
changes.
2024-04-26 14:45:23 +02:00
Simon Hausmann
31767eb6ab Add a clear-focus()function on all elements that have a focus() function
This is the counter-part, which removes focus from the element if it's currently focused. The window - if focused - may still be focused towards the windowing system.
2024-04-26 11:09:11 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Simon Hausmann
68083243b2
Add an in-out boolean color-scheme property to Palette (#4701)
This allows applications to force dark/light mode, as well as determine
which mode is active.
2024-03-26 15:44:22 +01:00
Simon Hausmann
ed2816331e
Add support for raw-window-handle (#4918)
Add a `raw-window-handle-06` feature to the Rust API crates, which adds support for version 0.6 of rwh to slint::Window, by delegation adding a `window_handle()` function that returns a struct that implements the corresponding traits from rwh.

HasDisplayHandle could also be provided on the backend, but that can be
done separately if needed.

This is only implemented for the winit backend right now.

cc #877
2024-03-22 14:25:05 +01:00
Olivier Goffart
b46effe65c Android: selection handle
Have two selection handle when there is selected text
2024-03-22 09:19:53 +01:00
Olivier Goffart
528f85509b android: Moving cursor handle 2024-03-20 12:46:10 +01:00
Olivier Goffart
9f0c3c94a9 C++: minimize/maximize/fullscreen API on Window 2024-02-22 13:17:50 +01:00
Ralph Minderhoud
9cb1a4a4e0
Add API for minimize/maximize on Window component (#4581)
Closes #4400
2024-02-22 10:40:36 +01:00
Tobias Hunger
a8f912900b janitor: Fix warnings in nightly about redandant use 2024-02-19 17:05:21 +01:00
Olivier Goffart
f73c08304c PopupWindow: explicitly call set_visible(false)
For native PopupWindow (qt backend) instead of relying on the destructor
to close the popup (usually in the next event loop, if no one had a hold
on any ComponentRc from the popup) do call set_visible(false) so the
popup can be hidden immediatly

CC: https://github.com/slint-ui/slint/discussions/4532#discussioncomment-8366080
2024-02-05 13:47:55 +01:00
Olivier Goffart
e0efbc49bd Set the WindowItem geometry in WindowInner::set_component
Notmaly the geometry is set in WindowInner::show()
But when calling set_component on an existing window, this is not
called.
This Fixes the slint-viewer reloading with the software renderer.
2024-01-31 13:54:45 +01:00
Olivier Goffart
4a4816afb2 Hold a SlintContext in the Window 2024-01-29 15:34:48 +01:00
Olivier Goffart
fa24283cd4 Add a few funciton to make SlintContext usefull
Make it possible to spawn future and run event loop with a SlintContext
handle
2024-01-29 15:34:48 +01:00
Olivier Goffart
18022b16b0 Move the SlintContext to a different module 2024-01-29 15:34:48 +01:00
Olivier Goffart
3ffe7e7be9 Input method: re-send the text if we notice that the text has changed when rendering
Otherwise, programatic changes to the text are not told to the input
methods.
This is important in the case of the todo example on android.
For example if one type
`foo<enter>bar`, the enter will cause foo to be added in the list, and
the text will be cleared. But then when typing bar, the input method
things "foo" is still in the text and "foo" will be re-added
2024-01-26 13:47:33 +01:00
Olivier Goffart
808db75022 Make sure that double click on two different item is not registered as double click
This is going to be tested as part of tests/cases/elements/toucharea_doubleclick.slint
once we used the click_count for the double_click callback
2024-01-24 10:20:06 +01:00
Olivier Goffart
9111946a82
Introduce slint::run_event_loop_until_quit
Closes #1499
2024-01-11 13:52:02 +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
Harold
779aff0b39
Added set_fullscreen API to WindowAdapter. (#4286)
See #3283
2024-01-09 15:23:23 +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
Olivier Goffart
9ff13faee8 Implement the quitting on windows close in i-slint-core and not in the platform
Step towards #1499
2024-01-08 21:17:52 +01:00
Simon Hausmann
ed54581aa1 Fix support for creating context menus on mouse press
When bringing up a popup menu on mouse press,
don't close it on release if the pointer is inside.
2024-01-06 10:45:34 +01:00
Simon Hausmann
c5aebcfde3 Fix close behaviour of PopupWindow
- Close on release when the mouse pointer is inside the popup
- Close on press when click is outside
2024-01-06 10:45:34 +01:00
Olivier Goffart
e9079e6db5 Fix position of grabbed event on popups
Fixes #4033  (combobox don't select entries)
Fixes #4036
2023-11-30 10:18:30 +01:00
Jocelyn Turcotte
678c7678e9 C++ API for KeyEvent.repeat
Add a new dispatch_key_press_repeat_event function to dispatch auto-repeated
key events.
2023-11-29 09:31:31 +01:00
Olivier Goffart
7008b11e3e Properly send exit events when mouse is outside of a PopupWindow
... for non-native PopupWindow.

We first need to handle the grabbed event regardless of popup window.

Then, if we are outside of the popup window, we should send exit events
so that, for example, the has-hover and mouse cursor get properly
updated.

Fixes #3934
2023-11-23 07:25:46 +01:00
Olivier Goffart
84202f6af3 Fix ComponentContainer causing panic when using forward-focus
The ComponentContainer is usually instentiated when trying to evaluate a
property such as the geometry or moving the focus. But the init code of
the ComponentContainer would then tries to change the focus which will
indirectly re-visit items and recurse into some property which are being
evaluated.

We do not need to set the focus on instentiation of the
ComponentContainer anyway, intentiating it shouldn't change the current
focus.

This fixes the LSP preview crashing when trying to preview a component
that has forward-focus

Fixes: #3950
2023-11-22 14:13:27 +01:00
Olivier Goffart
1efd83621d Refactor: Merge KeyInputEvent and KeyEvent
Both structure are bascially the same and only used internally, no need
to have the two.

The only difference was that one had the modifiers and the other one
not. But we can just set the modifier at the point we were converting
between the two.
2023-11-02 12:16:40 +01:00
Olivier Goffart
bebec49398 Refactor input_method_request
Part of #3811

But this is still on the internal trait for now
2023-11-02 12:16:40 +01:00
Simon Hausmann
fff15b9018 Don't close embedded popups when clicking outside and click-on-close: false is set
cc #3712
2023-10-27 11:49:09 +02:00
Olivier Goffart
12cd8e71f1 WIP: some polish over the winit update to 0.29 2023-10-23 14:22:48 +02:00
Tobias Hunger
b12575a4c4 janitor: Go over our spell checking setup
* Extend the cspell word list
* Remove those extensions from individual source files
* white-list licenses and such as we should not meddle with those
* Fix spelling
2023-10-16 09:01:51 +02:00
Olivier Goffart
b88a3caacd swrenderer: Put the rotation feature behind a freature gate
We're not ready to make the API public as we want to have the API as
part of the Window rather than part of the renderer
2023-10-09 18:07:23 +02:00
Olivier Goffart
852b4d906d Rename ComponentVTable to ItemTreeVTable
and their related name.
Also move the component module in the item_Tree module
register_component -> register_item_tree
ComponentItemTree -> ItemTreeNodeArray

For #3323

Rationale from that issue:

Right now, we use the term `component` in the Slint language and in the compiler to be a a tree of elements that can be used as an element in a .slint file.

The term is also currently used in the runtime as a tree of runtime Items that are allocated together. (declared in ComponentVTable)

But there are no 1 to 1 mapping between a `component` in the slint language, and a runtime Component.
(for example, the items behind a `if` or `for` or `PopupMenu` are in a different runtime component. And `component` declared in Slint are often inlined)

So we should rename the internal runtime `Component` to  `ItemTree`

The currently public `slint::ComponentHandle` wraps the "root" of the ItemTree, but that's ok because it is generated from a .slint `component`,  so it doesn't change name
2023-10-09 11:01:56 +02:00
Olivier Goffart
cfda569e56 More use of item_geometry 2023-09-13 16:08:37 +02:00
Olivier Goffart
083023866d Use the item_geometry from ComponentVTable 2023-09-13 16:08:37 +02:00
Olivier Goffart
8f16b519a2 use #repr(uX) instead of repr(C) for fieldless enums
Otherwise the ABI may differ between the C++ and the Rust
2023-08-31 10:22:03 +02:00
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
67423b288f Add documentation to the WindowAdapters to explain the basic message passing protocol
... and provide hints in there about implementing window close requests.

Note: The links to set_size() and set_position() are not resolved, as
these virtual functions are still missing from the WindowAdapter base
class.
2023-08-28 13:45:28 +02:00
Simon Hausmann
de58d5e83c Keep the component alive when the window is visible
show() now let's Slint maintain a strong reference to the component, so
that it's easy to create new windows without having to do an awkward
dance around keeping the component alive.

Closes #3328
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
44a8147201
Rust platform API to query window properties 2023-08-22 18:32:50 +02:00