Tobias Hunger
cbeecfefba
Remove unnecessary clone() calls
...
window is just &self once the redundant clone() call has been removed,
so remove that variable entirely.
2021-08-04 22:50:35 +02:00
Tobias Hunger
ce976a1dbb
Janitor: Fix clippy::useless_conversion
2021-08-04 22:50:35 +02:00
Tobias Hunger
24a2021226
Janitor: Fix clippy::needless_borrow
2021-08-04 22:50:35 +02:00
Tobias Hunger
22c65707b2
Janitor: Fix clippy::len_zero
2021-08-04 22:50:35 +02:00
Tobias Hunger
60ef093aaa
Janitor: Fix clippy::len_without_is_empty
2021-08-04 22:50:35 +02:00
Tobias Hunger
57ed130380
Janitor: Fix clippy::from_over_into
2021-08-04 22:50:35 +02:00
Olivier Goffart
1dab4c35d9
For embedded data, store the extension in the binary
...
This is usefull for the detection of SVG
2021-08-03 16:15:31 +02:00
Simon Hausmann
bd556e03be
minor cleanup: add transparent marker
...
to make the reinterpret casting between the inner and outer types a bit ... safer
2021-08-03 10:32:04 +02:00
Simon Hausmann
29f5853332
Provide sixtyfps::Window
by reference in the Rust API
...
This also removes Clone from the Window again, to avoid having to face
the question: Does cloning a window duplicate it on the screen?
2021-08-03 10:32:04 +02:00
Simon Hausmann
d87cfb4b1e
internal cleanup
...
Move the WindowHandleAccess impl for api::Window into the super module
so that we don't need the #[doc(hidden)] attribute.
2021-08-03 10:32:04 +02:00
Simon Hausmann
66891a299c
Start a new sixtyfps::Window API for Rust, C++, the interpreters and JS
...
The generated component now provides access to a Window type
via the window() accessor function.
This is part of #333
2021-08-03 10:32:04 +02:00
Simon Hausmann
17b3fbc7cf
Fix cursor navigation when using combining characters
...
The cursor navigation left/right (and subsequently text selection) needs
to respect grapheme boundaries. Since we already depend on the
unicode-segmentation crate through femtovg, we might as well use the
functionality for determining grapheme boundaries from there.
The only place where the cursor navigation is allowed to break that is
when using backspace, as that allows the user to break glyph clusters.
2021-08-01 09:35:19 +02:00
Tobias Hunger
f1f0182826
Janitor: Fix clippy::needless_return
2021-07-30 09:27:48 +02:00
Olivier Goffart
bd52f4d444
Allow the clip property to be a dynamic property
2021-07-29 15:02:25 +02:00
Tobias Hunger
9539a53480
Janitor: Fix clippy::redundant_clone
2021-07-23 13:48:52 +02:00
Tobias Hunger
d64291245e
Janitor: Fix clippy::len_zero
2021-07-23 13:48:52 +02:00
Tobias Hunger
3e0534afea
Janitor: Fix clippy::needless_lifetimes
2021-07-23 13:48:52 +02:00
Olivier Goffart
7e0136b11d
Fix panic when exiting the sixtyfps-viewer when a TextInput is focused
...
The viewer holds the component in a thread_local, so when it is being
dropped, thread_locals are already destroyed.
When an TexInput is focused, it holds a Timer for the blinking cursor,
so when that Timer gets drop'ed, we must not access the thread_local
2021-07-22 14:38:58 +02:00
Simon Hausmann
eaddbe664e
internal cleanup: Rename ComponentWindow to WindowRc
...
That's all it is nowadays, it's a wrapper around Rc<Window>. It's not an
alias because we need to also "wrap" it to C++ via cbindgen, but that's
about it.
2021-07-21 20:33:02 +02:00
Tobias Hunger
aeebbb1d96
Janitor: Fix remaining clippy::option_map_unit_fn
2021-07-21 19:44:57 +02:00
Simon Hausmann
1c285694d7
internal cleanup: Remove the use of ComponentWindow in the interpreter
2021-07-21 17:41:12 +02:00
Simon Hausmann
ef184f7f1a
internal cleanup: Remove the rest of the ComponentWindow API
...
Now it just remains a wrapper around the Rc, and it can soon be moved to
the API crate hopefully.
2021-07-21 17:41:12 +02:00
Simon Hausmann
77ea5b7a15
API cleanup: hide the rest of the ComponentWindow "internals"
2021-07-21 17:41:12 +02:00
Simon Hausmann
4c1d9dc03e
internal cleanup: Remove the poup functions from ComponentWindow
...
Use WindowHandleAccess instead. Also the clone()
isn't needed anymore since the function take a self reference instead of an Rc<Self> by value.
2021-07-21 17:41:12 +02:00
Simon Hausmann
e005058285
internal cleanup: remove free_graphics_resource from the public ComponentWindow API
...
Use the WindowHandleAccess backdoor instead.
2021-07-21 17:41:12 +02:00
Simon Hausmann
e4717824f8
internal cleanup: Prepare for more Window internals encapsulation
...
Hide access to the internals behind a trait that won't be re-exported
into the public Rust API. This allows removing as_any() again.
2021-07-21 17:41:12 +02:00
Simon Hausmann
e902395d09
Trim the Rust ComponentWindow API a little bit more
...
* Remove some public wrapper functions that are crate internal
2021-07-21 17:41:12 +02:00
Simon Hausmann
2553dd1459
Trim the Rust ComponentWindow API and implementation a little bit
...
* Remove the `new` function from the main impl and use the slightly
less visible From conversion trait
* Make the inner Rc<Window> pub(crate) instead of pub
* Instead, provide a public as_any() accessor that the Qt backend can use
2021-07-21 17:41:12 +02:00
Simon Hausmann
492af0f67c
Rename the implementation of the Window
item to WindowItem
...
If we were to add `sixtyfps:🪟 :Window` to the re_exports, then
this clashes. We might rename the former, but this is a cleaner naming
in any case.
Relates to #333
2021-07-20 17:50:17 +02:00
Olivier Goffart
1360f1e26e
Added icon property to the Window element
2021-07-20 16:34:19 +02:00
Simon Hausmann
68626e27fb
internal cleanup: simplify free_graphics_resources trait signature
...
This allows then routing the call through window::Window's Deref impl
2021-07-20 16:19:45 +02:00
Olivier Goffart
673c0ce81c
Add a as_any to the Model trait to allow getting a reference to the original model
2021-07-20 15:38:10 +02:00
Simon Hausmann
f4ffbd3d3d
Fix panic when editing text after programmatically replacing it
...
When replacing the text, it may happen that the cursor position becomes outdated.
As per #331 we should make sure that this is handled also on an API level,
but this patch at least avoids the panic triggered by using editing.
2021-07-19 18:30:06 +02:00
Olivier Goffart
1eb54a4743
The clip property now clips the mouse events
...
Fixes #180
Note that there is still a small issue that the clipped element may
not recieve the MouseExit event because it is still considered
having the mouse.
2021-07-12 15:39:39 +02:00
Tobias Hunger
5b37521e0a
Janitor: Allow warning about unnecessary closures
2021-07-12 15:01:19 +02:00
Tobias Hunger
b29360dc5c
Janitor: a = a % b
is a %= b
2021-07-12 15:01:19 +02:00
Tobias Hunger
a5f4645640
Janitor: Spelling fixes
...
Work around cspell not liking words ending in `'s` :-)
2021-07-12 15:01:19 +02:00
Tobias Hunger
58cbfa780d
Janitor: Spell out argument
2021-07-12 15:01:19 +02:00
Tobias Hunger
9608825eb2
Janitor: Use if let
over Option::map
returning ()
2021-07-12 15:01:19 +02:00
Tobias Hunger
b24e52e0fa
Janitor: Remove useless addition on 0
...
This quietens a clippy warning, but also breaks symmetry:-(
2021-07-12 15:01:19 +02:00
Tobias Hunger
ede172b758
Janitor: Spell out local variable names
2021-07-12 15:01:19 +02:00
Tobias Hunger
925afb2ba4
Janitor: Remove unnecessary lifetimes
2021-07-12 15:01:19 +02:00
Tobias Hunger
5f488bd7fc
Janitor: Spell out local variable name
2021-07-12 15:01:19 +02:00
Tobias Hunger
70f4eff2d5
Janitor: !(a > 0)
is a <= 0
2021-07-12 15:01:19 +02:00
Tobias Hunger
d68ac7a664
Janitor: CSpell ignore coord in document
2021-07-12 15:01:19 +02:00
Simon Hausmann
9b4752bdfa
Silence cSpell on window.rs :)
2021-07-12 14:14:12 +02:00
Tobias Hunger
ad98137c17
Janitor: Mark up float comparisons where we want bitwise identity
...
Mark up test cases where we want bitwise identity of float values and
use `assert_eq!` since that produces better output in the error case.
2021-07-09 17:00:46 +02:00
Tobias Hunger
2fdfbae33e
Janitor: Remove unnecessary lifetimes
2021-07-08 20:43:38 +02:00
Tobias Hunger
35dd3ed282
Janitor: Remove redundant clone() calls
2021-07-08 20:43:38 +02:00
Tobias Hunger
f24df0f94f
Janitor: Typo fixes
2021-07-08 20:43:38 +02:00