Tobias Hunger
34d461cb2b
Janitor: Fix clippy::clone_on_copy
2021-07-30 09:27:48 +02:00
Olivier Goffart
43e07320a5
Fix comments and naming found in review in #355
2021-07-28 16:57:09 +02:00
Olivier Goffart
7821926002
Rust: defaults to the native
style when Qt is available
...
This requires some gymnastics to get right as the information
need to be passed to the compiler despite having no direct dependency
between the compiler and the runtime or backends.
So use a file in the build directory to tell the default style
cc: #83
2021-07-28 16:57:09 +02:00
Simon Hausmann
3d1c71b762
Fix formatting (cargo fmt)
...
Amends f75745ea30
2021-07-27 19:37:06 +02:00
Simon Hausmann
aacb47dfaf
qt native button: Apply suggestions from code review
...
Add the icon type explicitly to make it easier to do "eye" based type matching with the cpp! macro.
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-07-27 19:37:06 +02:00
Simon Hausmann
14c6819791
Add support for icons in the Button widget
...
The icon in the gallery example was generated via https://emoji.aranja.com
2021-07-27 19:37:06 +02:00
Simon Hausmann
dbdd8d8cb3
cspell: silence in fonts.rs
2021-07-26 14:37:40 +02:00
Simon Hausmann
40e7d45e2d
Tweak manual font fallbacks on Linux
...
Add the noto color emoji font that's default on Ubuntu at least
(until we can use fontconfig proper)
2021-07-26 14:37:24 +02:00
Tobias Hunger
d34fd5add2
Fix float comparison in qt_window.rs
...
Amends 02bdcbf6ff
2021-07-24 22:53:52 +02:00
Tobias Hunger
2cdc5848a2
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-23 13:48:52 +02:00
Tobias Hunger
27b42687fa
Janitor: Fix clippy::redundant_closure
2021-07-23 13:48:52 +02:00
Tobias Hunger
9539a53480
Janitor: Fix clippy::redundant_clone
2021-07-23 13:48:52 +02:00
Tobias Hunger
1c21ba89ee
Janitor: Fix clippy::if_let_some_result
2021-07-23 13:48:52 +02:00
Tobias Hunger
97be634b9b
Janitor: Fix clippy::match_like_matches_macro
2021-07-23 13:48:52 +02:00
Tobias Hunger
8d83ce88d7
Janitor: Fix clippy::excessive_precision
2021-07-23 13:48:52 +02:00
Tobias Hunger
3e0534afea
Janitor: Fix clippy::needless_lifetimes
2021-07-23 13:48:52 +02:00
Tobias Hunger
b61dcc42b9
Janitor: Fix clippy::double_parens
2021-07-23 13:48:52 +02:00
Tobias Hunger
2a6560b073
Janitor: Remove unecessary cast
...
Prefer a u8 literal over an i32 literal that is then cast to a u8
2021-07-23 13:48:52 +02:00
Tobias Hunger
67586b12e4
Janitor: Do float comparison dance in qt_window.rs
2021-07-23 13:48:52 +02:00
Olivier Goffart
da6897f4c6
native style: Fix clipping in NativeListView
...
The Style is overriding the clip, so we need to set the system clip
to make sure that clips are combined.
2021-07-22 22:29:52 +02:00
Olivier Goffart
6aa6dec9b4
Small simplification on the usages of ListView
...
Now that the height computation is done properly
2021-07-22 17:29:53 +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
Simon Hausmann
1c285694d7
internal cleanup: Remove the use of ComponentWindow in the interpreter
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
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
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
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
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
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
Tobias Hunger
b105d6add3
Janitor: Do the float comparision dance
...
I think it is actually makes sense in this case!
2021-07-09 17:00:46 +02:00
Olivier Goffart
13bd828b96
Update license date
2021-07-02 15:55:54 +02:00
Simon Hausmann
035dfc3d1f
A few harmless spelling fixes
2021-06-30 22:14:10 +02:00
Simon Hausmann
8dc6ee6fb1
Fix font fallback list on macOS with default family
...
Even with an empty font family we should produce a font fallback list, and we can.
Fixes the missing checkmark (when not affected by clipping).
2021-06-30 15:46:30 +02:00
Olivier Goffart
6ffe456fd8
Qt backend: use QChar::LineSeparator to split lines in a QTextLayout
...
That's better than re-layouting with setNumColumns
2021-06-30 13:33:19 +02:00
Olivier Goffart
5bbd4b1afb
Qt backend Text elision with word-wrap
2021-06-30 13:33:19 +02:00
Olivier Goffart
bc8bc616ed
GL backend: elide Text also when word-wrapping
...
In this case, the last line will have elipsis on the last line
when no more line can be printed
Note that the behavior is different with the Qt backend
2021-06-30 13:33:19 +02:00
Simon Hausmann
a0e827e200
Work around black window with vmware/glutin/windows10
...
Glutin's desire to default to srgb mysteriously creates a black window
on Windows 10 under Vmware. I tested this with many glutin apps and examples,
they all exhibit the same: black window,
working when query for srgb is turned off.
This used to work, so I suspect some change underneath on the vmware svga
driver perhaps, or Windows.
2021-06-29 22:53:48 +02:00
Olivier Goffart
a58daa31c9
Fix popup size
2021-06-29 09:30:07 +02:00
Simon Hausmann
61d533812d
Bump femtovg and ttf_parser version
...
They are now in sync with the latest due to a new rustybuzz release
2021-06-28 11:08:06 +02:00
Olivier Goffart
98cec35080
Increase version numbers
2021-06-28 10:39:43 +02:00
Tobias Hunger
13d7f5e7bd
Janitor: Fix typos in comments and user-facing strings
...
Also adapt tests for error messages containing the fixed strings.
No behavior change is intended!
2021-06-28 08:32:25 +02:00
Tobias Hunger
68259162c8
Janitor: Fix typo in local variable name
...
No behavior change is intended here.
2021-06-28 08:32:00 +02:00
Olivier Goffart
6ed58fb041
Testing backend: don't panic on popup close
2021-06-23 15:25:29 +02:00