Commit graph

147 commits

Author SHA1 Message Date
Olivier Goffart
af573e6401 vtable: Don't automatically add extern C
Some checks are pending
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.82) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
2025-06-06 14:47:46 +02:00
Olivier Goffart
f91b61c8ee corelib: Remove the extern call in the vtable for wasm
In fact, remove it for non-C++

Because wasm doesn't support C-unwind. And actually warns about
incompatible ABI for the rest

Fixes #8449
2025-06-06 14:47:46 +02:00
Olivier Goffart
f39b3ab888 Use "C-unwind" API in our vtable
When using rust, allow panics to cross the boundaries of our vtable traits.
This avoids panic producing two backtrace with panic=unwind

This patch doesn't touch the ABI of out FFI interface, they stay extern "C", because
if a panic or exception crosses these boundaries, we are in trouble.
(Also, we have a panic=abort in our Cargo.toml anyway)
2025-06-06 14:47:46 +02:00
Avery Townsend
8c4ccabf7d
Expose FocusReason to .slint as an argument in focus-event-changed and add focus-gained and focus-lost callbacks (#8569)
This exposes FocusReason to .slint, and adds it as an argument to focus-event-changed callback on FocusScope to close #8387. It also adds two new callbacks, focus-gained and focus-lost, which are identical to focus-event-changed but are only invoked on focus gain or loss respectively.

In addition to this, it removes the FocusEventReason::AccessKit variant, replacing it with the mouse variant to hopefully make AccessKit more compatible with any Slint code that will use FocusEventReason.

Finally, I added two tests based on focus_change_event.slint, one for testing the FocusEventReason argument and another for testing the new callbacks.

close #8387

ChangeLog: Added `focus-gained` and `focus-lost` callback to FocusScope.  Pass an `FocusReason` enum to the FocusScope callbacks
2025-06-04 09:51:26 +02:00
Olivier Goffart
23962b3e25
Upgrade cbindgen and use unsafe(no_mangle) attributes (#8539)
To be compatible with the 2024 edition, we need to wrap the
`no_mangle` attribute in `unsafe()`.

The parsing for that in cbindgen was only added in the version 0.28,
but we couldn't upgrade cbindgen before because of a regression in
cbindgen 0.27 that prevented us from upgrading.
Now that cbindgen 0.29 is released with a fix, we can prepare for the
2024 edition
2025-05-26 11:21:33 +02:00
Montel Laurent
4cd6f92013
Hide action when widget is disabled
ChangeLog: TextEdit/LineEdit : disable context menu action when the widget is disabled or read-only
ChangeLog: Added ContextMenuArea::enabled
2025-05-02 13:20:46 +02:00
Simon Hausmann
fecc5a7b4d Move font resolution specific window item getter into resolve_font_property
This isn't needed anywhere else right now.
2025-04-24 09:18:45 +02:00
Simon Hausmann
b098bccc32 Propagate default font properties into PopupWindow 2025-04-24 09:18:45 +02:00
Simon Hausmann
eb825f2e95 Support default-font-* properties in Live-Preview
... by changing the resolution for the `WindowItem` to traverse the
item tree from the current item, instead of going to the window.

This doesn't quite fix #4298 because `rem` resolution is still missing.
That requires the built-in default font size function to be fixed as
well, which is non-trivial.

cc #4298
2025-04-24 09:18:45 +02:00
Olivier Goffart
6010cf724c Hover on MenuBar should activate menu if a menu is already open
Fixes #7822
2025-03-31 14:06:24 +02:00
Olivier Goffart
7cb903aa77
janitor: Fix comment in items.rs 2025-03-05 08:16:32 +01:00
Olivier Goffart
7390df1b47
ContextMenuArea: Intercept long press on Android 2025-02-24 18:27:25 +01:00
Simon Hausmann
8372cd6412
Convey clipping of children to accesskit (#7587)
and while at it, move is_clipping_item() that casts a function of the ItemVTable.

Fixes #2341
Fixes #7382
2025-02-10 13:42:10 +01:00
Olivier Goffart
c0b72cad2f
ContextMenu: show submenu on hover after a timeout
This means that the parent menu still get the mouse events

Also add the ability to close the menu programmatically
2025-02-07 13:27:32 +01:00
Simon Hausmann
a4709b211e Cleanup: Rename bounding_rect_for_geometry to bounding_rect 2025-01-30 10:55:28 +01:00
Simon Hausmann
e576f7b4ee Use a zero sized bounding rect for Empty/TouchArea/FocusScope/SwipeGestureHandler
These don't draw anything.
2025-01-30 10:55:28 +01:00
Simon Hausmann
4a6b4d9dfa Add support for bounding text rendering with the partial renderer
cc #7247
2025-01-30 10:55:28 +01:00
Simon Hausmann
58ea5389f8 Add support for box shadows with the partial renderer
cc #7247

Fix comment in partial renderer's filter_item() about dependency tracking

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-01-30 10:55:28 +01:00
Olivier Goffart
010126992e MenuItem with for and if 2025-01-30 10:08:22 +01:00
Simon Hausmann
05e70e8c8b Fix support for Window.background tracking with the partial renderer
Fixes #5219
2025-01-29 16:32:42 +01:00
Simon Hausmann
cf9b515a92 Clean up rendering of component container
Instead of creating a dummy Rectangle with background property, implement a RenderRectangle trait.
2025-01-29 12:39:40 +01:00
Olivier Goffart
28e54175f6 Work on the ContextMenu
- Add the `entries` property in the ContextMenu
 - Make right click on the ContextMenu show the menu
 - Use the proper technique to register ContextMenu and MenuBar as
   experimental (same as ComponentContainer)
2025-01-16 20:21:06 +01:00
Benny Sjoestrand
5ef4aace4c Implement full-screen property for slint Window item
Make it possible to programatically to switch to full-screen mode
via a new property in the Windows item.
The SLINT_FULLSCREEN environment variable will default set this
property to true. However settings this property in the slint code
will override the SLINT_FULLSCREEN.

Fixes #6665
2024-12-16 09:52:40 +01:00
FloVanGH
0d1412afc5
removed skip-taskbar property from window (#6982) 2024-12-03 10:07:36 +00:00
FloVanGH
712f930897
windows: added skip_taskbar (#6911)
* Update internal/backends/winit/winitwindowadapter.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/backends/winit/winitwindowadapter.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update docs/src/content/docs/reference/window/window.mdx

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

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-11-27 09:55:11 +00:00
Olivier Goffart
5bd20def0e Experimental support for MenuBar
Introduces `MenuBar{ ... }` that can be put in a Window
2024-11-20 09:25:37 +01:00
Josh Wood
6a131e2648
Added PropertyAnimation.direction property for controlling animation direction (#6261)
Closes #6260

ChangeLog: Added property for controlling animation direction
2024-09-24 19:55:24 +02:00
Simon Hausmann
cd2b738c7a Rename SwipeGestureRecognizer to SwipeGestureHandler
The origin of this proposal is the name of the `swipe-left`, etc.
directional, boolean properties. They're missing another verb in their
name. In principle the right choice would be "recognize". That is what
the type name suggests, that's the term the documentation uses, so the
code should read `recognize-swipe-left: true;`. However that is a long
word. "Handle" is a verb that's simpler. It's also more generic (that's
a downside), but it's otherwise short enough to make things look
"right":

```
SwipeGestureHandler {
    handle-swipe-left: true;
    swiped => { something.naviate-left(); }
}
```

Therefore this patch proposes to rename the type to SwipeGestureHandler
and prefixes the boolean directional properties with "handle".
2024-09-18 16:37:27 +02:00
Olivier Goffart
5663ddd9cc
SwipeGestureRecognizer (#6005) 2024-09-09 14:40:55 +02:00
Olivier Goffart
80c497b319 refactor: move FocusScope and TouchArea to a new input_items.rs module
items.rs is getting big and i'm about to add another item there
2024-08-29 09:38:26 +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
Olivier Goffart
35a6e7bde5 Split Text item into SimpleText and ComplexText
SimpleText has all the most common properties and is half the size
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
Simon Hausmann
a1857e6154 system testing: add a unit test to verify that the manual AccessibilityRole mapping is always complete
The enum is non-exhaustive, but we can do an additional run-time check.
2024-06-14 07:46:36 -07:00
Luc Fauvel
44a537d902
Implemented resizing for non-decorated winit windows (#5026)
Fixes #5023

* Implemented resizing for non-decorated winit windows

* Fixed formatting

* Changed direction match to use a tuple, reduced resize border size, returned after handling resize

* Added is resizable check for before resizing winit window

* Added resize-border property to window

* Formatted code

* Change resize-border from float to length
2024-06-06 11:17:05 +02: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
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
Olivier Goffart
5c381fd73e Fix clipping and border-radius
Fix #4854
2024-03-14 23:48:16 +01:00
J-P Nurmi
cc5d2b24e5 Add BasicBorderRectangle to avoid unnecessary xxx-border-radius bindings 2024-02-06 18:01:35 +01:00
J-P Nurmi
5e086971c9 Add RenderBorderRectangle trait 2024-02-06 18:01:35 +01:00
J-P Nurmi
031742246c Implement clipping 2024-02-06 18:01:35 +01:00
J-P Nurmi
51457025bf Add BorderRectangle::border_top|bottom_left|right_radius 2024-02-06 18:01:35 +01:00
Olivier Goffart
5ee47c78e6 TouchArea: reuse the click_count field in the event instead of re-implementing our own 2024-01-24 10:20:06 +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
Olivier Goffart
503baf2898 internal: Move the backend global instance in a SlintContext
The SlintContext will hold all the thread_local state.
A small step in the direction of #4294
2024-01-08 21:17:52 +01:00
Tobias Hunger
9737720cf2 touch-area: Trigger pointer-evnet on mouse move
Trigger the `pointer-event` callback on mouse move. This is of "kind"
Move and the mouse button will always be `Other`, but at least the mappings
will be correct:-)

Closes: #2770
2023-12-11 09:07:44 +01: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
3e3dd03566
Added focus-changed-event callback to FocusScope (#3650) 2023-10-17 17:30:19 +02:00