Commit graph

4096 commits

Author SHA1 Message Date
Tobias Hunger
02bdcbf6ff Janitor: Replace float comparison dance with approx_eq from euclid
Sixtyfps uses euclid already, so let's use euclid for float comparisons
as well.

I changed the code to decide whether a number is a positive integer to
make do without a comparison along the way.
2021-07-22 20:01:23 +02:00
Tobias Hunger
e45635656d Janitor: Fix clippy::redundant_closure 2021-07-22 16:05:08 +02:00
Tobias Hunger
e8aa79e762 Janitor: Fix clippy::redundant_clone 2021-07-22 16:05:02 +02:00
Tobias Hunger
f18f333fbb Janitor: Fix clippy::if_let_some_result 2021-07-22 16:04:43 +02:00
Tobias Hunger
f59bb6c606 Janitor: Fix clippy::match_like_matches_macro 2021-07-22 16:04:36 +02:00
Tobias Hunger
4763d4611b Janitor: Fix clippy::assign_op_pattern 2021-07-22 16:04:28 +02:00
Tobias Hunger
54c489e1fc Janitor: Fix clippy::len_zero 2021-07-22 16:04:17 +02:00
Tobias Hunger
3850b7192f Janitor: Fix clippy::excessive_precision 2021-07-22 16:04:10 +02:00
Tobias Hunger
2beac7aa07 Janitor: Fix clippy::needless_lifetimes 2021-07-22 16:04:00 +02:00
Tobias Hunger
fd745550b3 Janitor: Fix clippy::redundant_static_lifetimes 2021-07-22 14:21:01 +02:00
Tobias Hunger
353582779d Janitor: Spelling/grammar fixes in comments 2021-07-22 14:19:25 +02:00
Tobias Hunger
7a3771879f Janitor: Fix clippy::double_parens 2021-07-22 14:16:43 +02:00
Tobias Hunger
bf7b170044 Janitor: Fix clippy::comparison_to_empty 2021-07-22 14:10:46 +02:00
Tobias Hunger
0981cdf398 Janitor: Remove unecessary cast
Prefer a u8 literal over an i32 literal that is then cast to a u8
2021-07-22 14:07:22 +02:00
Tobias Hunger
a90fee12c9 Janitor: Do float comparison dance in qt_window.rs 2021-07-22 14:01:40 +02:00
Olivier Goffart
6265b7b9f6
Add a reference to cargo-ui in examples/README.md 2021-07-22 11:57:00 +02:00
Simon Hausmann
b8f208100c Minor doc fix: Link to the run_event_loop function mentioned in the docs
The formatting is not a code block, but I could not figure out how to do
that. A link is still better IMO than a difference in formatting.
2021-07-22 10:55:13 +02:00
Olivier Goffart
a095d8322e LSP: add a "Show preview" code lense 2021-07-22 09:19:41 +02:00
Olivier Goffart
0766ebbd0d LSP: update the lsp-types crate version 2021-07-22 09:19:41 +02:00
Simon Hausmann
8658e50e27 Fix typo 2021-07-22 09:04:55 +02:00
Simon Hausmann
3146fb7764 internal cleanup: Remove the sixtyfps::testing::HasWindow trait
and replace it with the internal, re-exported WindowHandleAccess
one.

Strictly speaking, this is a breaking change. In practice the
returned type of this trait was in `sixtyfps::re_exports`, so any
public use is questionable :)
2021-07-21 20:33:02 +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
57389c1731 Janitor: Fix remaining instance of clippy::redundant_clone 2021-07-21 19:44:57 +02:00
Tobias Hunger
aeebbb1d96 Janitor: Fix remaining clippy::option_map_unit_fn 2021-07-21 19:44:57 +02:00
Tobias Hunger
8b022cd917 Janitor: Fix remaining instance of clippy::iter_cloned_collect 2021-07-21 19:44:57 +02:00
Tobias Hunger
4bd8920ac4 Janitor: Fix clippy::declare_interior_mutable_const 2021-07-21 19:44:57 +02:00
Tobias Hunger
f02ab4d8c3 Janitor: Remove some unnecessary & 2021-07-21 19:44:57 +02:00
Tobias Hunger
a8b2aa2f2d Janitor: Fix cspell complaining about toint 2021-07-21 19:44:57 +02:00
Tobias Hunger
56fea6e6c3 Janitor: Fix clippy::many_single_char_names 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
b194c62c22 GL backend: Use the cache for the Window icon 2021-07-20 17:02:24 +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
mwaitzman
2d2afad670 polish to figma_import's README.md 2021-07-20 16:05:10 +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
mwaitzman
7ac752c40b updated erroneous link
The link to the blog post previously pointed to the root of the repo's docs folder.
2021-07-20 15:34:38 +02:00
Simon Hausmann
457ae53cde qt renderer: Fix difference between font metrics and rendering
When the widget itself is part of a hierarchy and some parent widget defines
font properties (such as weight, etc.) that aren't defined in .60, we would
inherit those for rendering, but not when measuring.

Since when measuring we don't have a widget, this patch disables all font
property merging from the widget hierarchy.
2021-07-20 13:33:25 +02:00
Simon Hausmann
9c65be3538 Mention fontconfig in the Linux build requirements
We might need to centralize that with the Rust and C++ API docs though
2021-07-20 12:42:30 +02:00
Simon Hausmann
1273391f3a Don't show non-existent glyph boxes for emojis on macOS
Instead, include the emoji font in the fallback list.
Once femtovg learns to render color fonts, they will show up.
2021-07-20 08:45: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
3078285114 Add sixtyfps::Weak::upgrade_in_event_loop 2021-07-19 15:57:29 +02:00
Simon Hausmann
609b134a0c Remove CMake from the macOS build requirements
The development branch does not need cmake anymore due to the freetype dependency removal
2021-07-19 08:59:32 +02:00