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
Tobias Hunger
3f5ad42683
Janitor: Fix typo in comment
2021-07-08 06:47:05 +02:00
Tobias Hunger
e5bdeaa804
Janitor: Remove unnecessary &
2021-07-07 08:42:28 +02:00
Tobias Hunger
23708a4a12
Janitor: Disable clippy error about f32 comparison
2021-07-06 22:54:05 +02:00
Tobias Hunger
4d712b3f4f
Janitor: Clippy suggests to collapse these ifs
2021-07-06 22:34:21 +02:00
Tobias Hunger
9b929b287d
Janitor: slice.iter().cloned().collect::<Vec<T>>() == slice.to_vec()
2021-07-05 09:48:29 +02:00
Tobias Hunger
8b3eda8a49
Janitor: Remove some useless 'static that clippy does not like
2021-07-05 09:48:29 +02:00
Tobias Hunger
96c792d7fc
Janitor: self: &Self is not canonical. Use &self instead
2021-07-05 09:48:29 +02:00
Tobias Hunger
c56e20233b
Janitor: Fix clippy error about a loop that never loops
...
This code abuses a loop for flow control. Split this out into a separate
function instead, using a custom enum to transfer the information back.
This is necessary since we need to transfer ownership of the
mouse_input_state back to the caller.
This change should not cause a behavior change.
2021-07-05 09:44:41 +02:00
Tobias Hunger
0aea249f1a
Janitor: Fix spelling in docs and rename local variables
2021-07-03 18:22:01 +02:00
Tobias Hunger
39984b27db
Janitor: Fix spelling in comments
2021-07-03 15:49:43 +02:00
Tobias Hunger
f762f6dab2
Sub_Assign should probably subtract, not add
2021-07-02 23:18:14 +02:00
Olivier Goffart
13bd828b96
Update license date
2021-07-02 15:55:54 +02:00
Olivier Goffart
9faf16ebe1
GridLayout: fix layout with rowspan and colspan
...
One should not simply distribute the maximum and minimum sizes amongst
the spans, one should make sure that each coinstraints is respected
2021-07-02 12:30:07 +02:00
Simon Hausmann
035dfc3d1f
A few harmless spelling fixes
2021-06-30 22:14:10 +02:00
Olivier Goffart
032a158615
GridLayout and span: ensure that the preferred size is properly distributed
2021-06-29 14:54:47 +02:00
Simon Hausmann
504bad7109
Drive-by typo fixes
2021-06-29 14:32:02 +02:00
Olivier Goffart
a4b9c0ced5
Old printer demo: fix the layout
...
Also, make sure empty cell in a GridLayout stretches
2021-06-29 12:33:01 +02:00