Commit graph

5155 commits

Author SHA1 Message Date
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
Olivier Goffart
07c1504627 Ammend previous commit
The test for empty text in NativeButton was meant for the sizeHint call,
not the render call.

Also fix a warning about unused variable
2021-07-16 22:30:38 +02:00
Olivier Goffart
ee53866afb Native style: fix sizing of the ComboBox 2021-07-16 22:15:51 +02:00
Simon Hausmann
e0ccdadc2a
Update wasm part of tutorial
Remove the paragraph that talks about adding the resolver line, since that’s already covered earlier, so the line is there.

Amends e3520b1ea6
2021-07-16 18:23:51 +02:00
Olivier Goffart
e3520b1ea6 Also recommand the use of resolver = "2" in the tutorial 2021-07-16 17:40:52 +02:00
Olivier Goffart
b3e58d58fe Add a note in the doc that recomands resolver = "2" 2021-07-16 17:32:08 +02:00
Olivier Goffart
00a734764a
Update install_qt.md 2021-07-16 17:21:49 +02:00
Olivier Goffart
f5de7e00a0 Make sure error messages don't end with '.'
As suggested in https://github.com/sixtyfpsui/sixtyfps/pull/275#issuecomment-881240725
2021-07-16 12:39:50 +02:00
Simon Hausmann
9f06136064 Fix slide puzzle auto mode checkbox
After commit 1eb54a4743,
mouse events would get clipped away and make it
impossible to tick the checkbox.
2021-07-15 18:57:50 +02:00
Olivier Goffart
722ae70284 Test: Don't use rust syntax to initialize C++ struct
I wonder why it worked with gcc, this is not even the C++20 syntax
2021-07-15 18:35:44 +02:00
Olivier Goffart
e633ee825d Fix error with struct that are only referenced by callbacks
We would have a compilation error in rust or C++ because the
collect_struct visitor would not visit these type and not produce
them correctly
2021-07-15 14:06:49 +02:00
Simon Hausmann
3aa959700c Revert "Attempt to fix a stack overflow in debug"
This reverts commit 51836a9457.

This is not needed anymore since PR #322
2021-07-15 12:20:01 +02:00
Simon Hausmann
42110263f6 Simplify field offset access workaround
As suggested by Olivier, we don't need the temporary variable. A ref followed
by immediate deref works just as well.
2021-07-15 12:19:20 +02:00
Simon Hausmann
aaf162d504 rust codegen: clarify comment about stack usage by referencing github issue 2021-07-15 12:19:20 +02:00
Simon Hausmann
30dbcdcaad rust generator: simplify field access code
There's no need for a separate access_self_field_offset function when
we can use format_ident directly.
2021-07-15 12:19:20 +02:00
Simon Hausmann
f7248a4863 Fix stack overflow with Rust generated code in debug builds on Windows
On Windows the default stack size is less than on Linux/macOS and
therefore an issues surfaces that is however operating system agnostic:

Due to inlining we generate quite big inner components with many fields.
Their field offsets are accumulated in the separate FIELD_OFFSETS
struct. The access pattern typically looks like this:

    Self::FIELD_OFFSETS.some_field.apply_pin(...)

This is destructed into at least two smaller operations, fetching
some_field and then calling apply_pin with that field as self parameter.

In Rust debug builds the first operation, unfortunately, ends up making
a full copy of Self::FIELD_OFFSETS into a temporary variable on the
stack. Unfortunately also that stack space isn't reused, so every access
results in a new stack allocation to hold all of the FIELD_OFFSETS
structure (~5kb in the printer demo).

With so many accesses to that in the generated code, we run out of stack
space already in the new() function, in item_tree() as well as in the
Drop impl that also accesses all field offsets.

This patch applies the following workaround that does the trick. The
above expression is replaced with

    {
        let field = &Self::FIELD_OFFSETS.some_field;
        *field
    }.apply_pin(...)

Fixes #133
2021-07-15 12:19:20 +02:00
Olivier Goffart
d7402be076 LSP: properly classify callback aliases in auto-complete
Otherwise the completion is wrong as it tries to complete
with `:` instead of `=>`
2021-07-15 11:10:05 +02:00
Tobias Hunger
ca53abdbc7 Janitor: calls to push immediately after creation
This is clippy::vec_init_then_push.
2021-07-15 07:55:06 +02:00
Tobias Hunger
5e2e8dac40 Janitor: Spelling fixes 2021-07-15 07:55:06 +02:00
Tobias Hunger
29039dac6d Janitor: calling insert_str() using a single-character string literal
This is clippy::single_char_add_str.
2021-07-15 07:55:06 +02:00
Tobias Hunger
efc0d63e8b Janitor: iter().cloned().collect() on a slice to create a Vec == to_vec()
This is clippy::iter_cloned_collect
2021-07-15 07:55:06 +02:00
Tobias Hunger
37619b8918 Janitor: OPTION.as_ref().map(String::as_str) == OPTION.as_deref()
This is clippy::option_as_ref_deref
2021-07-15 07:55:06 +02:00
Tobias Hunger
02557b0406 Janitor: Fix typos in comments 2021-07-15 07:55:06 +02:00
Simon Hausmann
91e2154a66 Remove the freetype dependency on Windows and macOS
It's not needed and this would fix #315
2021-07-13 19:29:49 +02:00
Olivier Goffart
cc8249212d Fix name conflict when having two global with the same name in different files
Give globals an unique id so two global with the same name imported
from different file don't clash

Fixes #159
2021-07-13 14:36:38 +02:00
Olivier Goffart
d81f07d20b Fix rustdoc warning 2021-07-13 11:51:50 +02:00
Olivier Goffart
cc7242c523 Add a selected callback to ComboBox 2021-07-13 11:42:31 +02:00
Olivier Goffart
6263979357 Add missing documentation for ComboBox 2021-07-13 11:34:47 +02:00
Simon Hausmann
3ce30092b1 cSpell: ignore focusable 2021-07-12 16:28:56 +02:00
Simon Hausmann
31ac05341a rust docs: Don't use depreacted highlightjs.highlightBlock, use highlightElement instead 2021-07-12 16:05:51 +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
024faa6322 Janitor: Use float comparison dance
Color values can be calculated, so do the full comparison dance instead
of doing the bitwise comparison.
2021-07-12 15:01:19 +02:00
Tobias Hunger
88b8634007 Janitor: Remove useless drop
This was dropping a referrence, which is a no-op. So remove this drop.
2021-07-12 15:01:19 +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