Commit graph

98 commits

Author SHA1 Message Date
Simon Hausmann
7122d22c88 janitor: use the new default attribute for enums 2022-12-05 10:20:39 +01:00
Simon Hausmann
247772104a Move WindowEvent, PointerEventButton and Key to the platform module
For `Key` this is a move, as it is a new type. For `WindowEvent` and `PointerEventButton` deprecated aliases
are provided.
2022-11-24 11:34:28 +01:00
Florian Blasius
61c39b5fa1 Add support for dispatching key events through the public platform API
This change adds `KeyPress` and `KeyRelease` variants to the
`WindowEvent` enum, along with the new `slint::Key` enum, that allows
encoding keys.
2022-11-15 10:34:17 +01:00
Simon Hausmann
38a55f87a4 Change internal MouseEvent to use logical points 2022-10-13 17:02:18 +02:00
Simon Hausmann
c11b4305c1 Change Item::geometry() to return a LogicalRect 2022-10-13 17:02:18 +02:00
Simon Hausmann
299325370d Change generated accessor functions for Property<Coord> getters to return LogicalLength 2022-10-13 17:02:18 +02:00
Simon Hausmann
dc8bc5690b Fix C++ build with changed KeyEvent
cbindgen does not support Option.
2022-10-07 11:16:36 +02:00
Simon Hausmann
8cba0622f5 Initial input method support for the winit backend and the FemtoVG/Skia renderers
Known caveats:

- winit doesn't forward mouse events to the IME, so clicking
  with the mouse while composing results in funny effects such
  as the pre-edit text following the cursor.
- With FemtoVG there's no text decoration support, thus no underlining
  of the preedit area.
2022-10-07 11:16:36 +02:00
Olivier Goffart
a45564bd2f Flickable: fix offset of the forwarded delayed mouse event
A recent commit introduced delayed press event, but the position of the
event was relative to the parent of the Flickable instead of relative to
the Flickable itself.

Fixes the printerdemo not expanding the element in the printer queue
2022-09-23 17:55:43 +02:00
Olivier Goffart
ba56f4e326 ChangeLog entry for the last two PR 2022-09-16 19:20:38 +02:00
Olivier Goffart
f954cb4ced Add a 100ms delay before forwarding the event in a Flickable
It was reported an annoying visual bug when flicking over a listview
with item that has a special effect on pressed, that the items would
show "pressed" for a brief instant.  This patch add a small delay before
sending the press event to the children.

The FIXME in the test is not a regression. (This happens because we send
Exited event to the children when flicking, despite the mouse is still in
the area)

Added a update_timers_and_animations from slint_mock_elapsed_time so we
don't have to call update_timers_and_animations ourselves in the test
anymore to fire the timers (it was previously only touching the
animation property)
2022-09-16 19:14:15 +02:00
Olivier Goffart
f91eac320d Refactor the mouse handling
Just make a single recursive function, it is easier to read than using
the visitor helper with a post and pre visit.

Also remove that function that visits with a post and pre visit as it is
no longer used
2022-09-16 08:45:46 +02:00
Simon Hausmann
7e5de3d5d3 Remove use of euclid types and tags for logical/physical position and size in the public API
Instead provide our own types.
2022-09-02 11:05:53 +02:00
Olivier Goffart
1237285fef Fixup some documentaion links
And add a test in the CI that checks for warnings in the internal
crates

(Also changed --exlcude in the test to be matching the one from build,
since c++ test are tested separately)
2022-09-01 12:16:24 +02:00
Tobias Hunger
0daa2513af API cleanup: Rename PointerEvent to WindowEvent
Also rename members and related functions as specified in #1543.

Fixes: #1543
2022-08-30 16:47:55 +02:00
Tobias Hunger
107e3ed2e2 janitor: Fix some typos 2022-08-29 16:53:47 +02:00
Tobias Hunger
1e6ffeaa0f API cleanup: Rename PlatformWindow to WindowAdapter 2022-08-29 16:53:47 +02:00
Simon Hausmann
1d436778c1 Remove the use of the PlatformWindowRc alias again
and use Rc<dyn PlatformWindow> instead. The alias has to stay with the ffi
functions though and the item vtable definitions,
because we don't have an Rc<> template in C++.
2022-08-19 15:07:27 +02:00
Simon Hausmann
fd026a3991 Change itemtable to use &PlatformWindowRc instead of &WindowInner
The former is cbindgen friendly, the latter is entirely Rust internal.
2022-08-19 15:07:27 +02:00
Simon Hausmann
3e42ae9838 Replace three more uses of WindowRc with &WindowInner 2022-08-19 15:07:27 +02:00
Lukas Jung
a639cb6d8e seperate text deletion code with move_mod 2022-08-19 13:31:24 +02:00
Olivier Goffart
16985a349d Add dispatch_pointer_event to the public API 2022-08-17 18:28:12 +02:00
Olivier Goffart
a62a5cbd19 Rename MouseEvent pos to position 2022-08-17 18:28:12 +02:00
Olivier Goffart
61739dcb81 Remove the Mouse prefix from enum value of the MouseEvent enum 2022-08-17 18:28:12 +02:00
Simon Hausmann
151ea2bdd0 Revert "janitor: move code for backspace and delete key shortcut recognition"
This reverts commit 49ea24c44a. This made
DeleteForward and DeleteBackward dead code because move_mod is always
true. Not worth the refactoring IMO.
2022-08-16 09:49:16 +02:00
Simon Hausmann
cca64bf29f Fix build 2022-08-16 09:47:44 +02:00
Simon Hausmann
49ea24c44a janitor: move code for backspace and delete key shortcut recognition
... into the section that checks move_mod, since the code now depends on it.
2022-08-16 09:35:57 +02:00
Simon Hausmann
81ca8f54c2
Add missing shortcuts for delete word forward and backwards (#1483)
* Add missing shortcuts for delete word forward and backwards

Fixes #1467
2022-08-16 08:24:56 +02:00
Olivier Goffart
3639ba2644 Don't expose the KeyEventType to .slint
This enum is not used in any builtin things anyway, so it shouldn't be
used at all in .slint code.
2022-07-22 12:23:52 +02:00
Tobias Hunger
7bf5c7e28e janitor: Use is_empty over comparison with len 2022-05-22 11:59:00 +02:00
Levin Rickert
e7aef68d1f accept wheel event from flickable 2022-05-19 16:45:29 +02:00
Levin Rickert
8a3b24868b add docs comment 2022-05-19 16:45:29 +02:00
Levin Rickert
5094a59f82 convert scroll to move event for flickable children 2022-05-19 16:45:29 +02:00
Levin Rickert
cdc9ea0e94 WIP 2022-05-19 16:45:29 +02:00
Olivier Goffart
e85e69fda0
Declare .slint enum in one place in i-slint-common
This avoid repeating the enums both in the compiler and in
the runtime library, and register them in a bunch of other places.

So it should be easier to add enums and enum values

Since cbindgen doesn't see through the macro, generate the enum
manually
2022-04-14 19:17:48 +02:00
Olivier Goffart
1b91158b46 corelib: allow to use i32 for coordinate instead of f32 2022-04-11 17:46:50 +02:00
Olivier Goffart
0429e11cf7 Refactor: Move ItemRc and ItemWeak to item_tree.rs
Keep items.rs for the implementation of items, and move the logic
that helprs navigating the tree to the item_tree.rs module
2022-04-07 16:59:38 +02:00
Tobias Hunger
49dee3a7eb Match up doc strings and code 2022-04-07 16:50:07 +02:00
Lukas Jung
4a7a84f253
Text shortcuts (#1129)
* Add moving by word to TextInput

* moving cursor to end of line, paragraph and text

* fix shortcut in cursor move test
2022-04-04 15:25:50 +02:00
Lukas Jung
98b084f80c Fix the redo shortcuts 2022-03-31 10:54:38 +02:00
Lukas Jung
54a2901777 Move TextShortcut to input.rs and rename Shortcut to StandardShortcut 2022-03-31 10:54:38 +02:00
Lukas Jung
1f5500ff7b Add Shortcuts to KeyEvent 2022-03-31 10:54:38 +02:00
Tobias Hunger
6795d3ee00
Introduce a FocusEventResult enum (#975) 2022-02-21 17:43:41 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Tobias Hunger
de4e195280
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs.

Add README.md files to all internal crates

... pointing to the official public crate to use instead.

Rename internal crates

fixup: README files

fixup rename
2022-02-07 13:12:48 +01:00
Olivier Goffart
03534039d6 Replace more .60 by .slint
Mainly an automated change with
    git grep -O"sed -i 's/\.60/.slint/g'" -w "\.60"

and some manual checks
2022-02-02 10:12:31 +01:00
Simon Hausmann
0bd627cad6 Rename the common crate 2022-02-01 18:00:25 +01:00
Tobias Hunger
e6b24bceec [reorg]: Set up and populate the internal directory
Move "internal" crates into the `internal` directory. This first batch
includes most of sixtyfps_runtime but leaves the rendering backends
alone for now.

pre-commit applied some cleanups to the moved files:
 - Consistent newline at end of file policy
 - trimming trailing whitespace
 - Formatting Cargo.toml files.
2022-01-31 16:00:50 +01:00
Renamed from sixtyfps_runtime/corelib/input.rs (Browse further)