Commit graph

954 commits

Author SHA1 Message Date
Olivier Goffart
ad2894e71b MCU: use a rp_pico::hal::Timer instead of the RealTimeClock
It has millisecond accurency, which is what we want
2022-01-24 11:06:36 +01:00
Olivier Goffart
e02486523b MCU: only repaint repaint the screen when there is something to draw 2022-01-24 11:06:36 +01:00
Olivier Goffart
e3f312633f MCU: Panic handler that prints the panic message on the screen 2022-01-24 11:06:36 +01:00
Olivier Goffart
57c98fd8ae MCU: Make sure we round the clip inside pixel boundary
...so we never end up drawing pixel outside the images
2022-01-24 11:06:36 +01:00
Olivier Goffart
d9622a9795 MCU: attempt to support the xpt2046 touch screen
Still not very well callibrated, but somehow works
2022-01-21 15:35:14 +01:00
Olivier Goffart
a746cefb18 MCU: make a backend that can run an eventloop 2022-01-21 15:35:14 +01:00
Tobias Hunger
0063476aff Update license information
Use the reuse tool to get a better grip on licenses used in sixtyfps.
Fix a couple of licenses along the way.

* Uses creative commons for our own logo (commercial use!)
* Fixes some license information found in README files and documents
  them with proper .license files.
* Document Apache/MIT for helper_crates/const-field-offset which matches
  what its documentaion site says it uses.
* Add a list of licenses that apply to crates we publish and the tooling
  we have.

This patch only adds static information and does not contain any tooling
support.
2022-01-20 14:45:02 +01:00
Simon Hausmann
0a50dd91a6 qt backend: provide a warning message when we fail to load an image
This helps to diagnose when an image format plugin is missing in Qt.
2022-01-20 13:46:55 +01:00
Olivier Goffart
f94e03bf4e The mcu backend is not ready to be published yet 2022-01-20 10:47:48 +01:00
Simon Hausmann
5bbc25fa82 Bump dependencies for the GL backend
Use newer resvg/usvg, femtovg and ttf-parser.
2022-01-19 15:35:21 +01:00
Tobias Hunger
0fc176a408 Document some licenses in a REUSE compliant way 2022-01-19 11:25:21 +01:00
Tobias Hunger
2f6be7b31f Mass-add copyright headers into Cargo.toml files 2022-01-19 11:25:21 +01:00
Olivier Goffart
6699067351 TabWidget: focus the tab when clicking on it
The Tab currently doesn't do anything with the focus, but this
serves as a workaround for #798 so that inner widget of a tab can't
keep the focus when they are hidden

cc #798
2022-01-12 14:54:04 +01:00
Simon Hausmann
c14c285fb2 Fix wasm build when fontdb has file system features enabled
That adds visibility to additional fontdb::Source variants,
which however are not reachable for us.

cc #826
2022-01-11 11:23:46 +01:00
Tobias Hunger
4c331f1ac2
janitor: More clippy fixes
None of these should be controversial: It is all similar to quick fixes
I pushed before.
2022-01-09 14:50:58 +01:00
Tobias Hunger
43e4b262c2
janitor: Remove some more unnecessary clone() calls 2022-01-09 14:34:03 +01:00
Tobias Hunger
2d2c560220 janitor: Remove unnecessary return statements
Some of these actually seem to make some stylistc sense
2022-01-09 13:46:33 +01:00
Tobias Hunger
d13067db04 Add key_code for BackTab 2022-01-08 20:37:18 +01:00
Simon Hausmann
ced05732a8 Improve robustness of unmapping windows with the GL backend
Make sure to make the GL context is current before destroying the femtovg canvas.

The drop implementation of the canvas will call functions to delete GL resources such as textures, FBOs, etc.
and for that to work reliably the context must be current.
2022-01-05 13:05:40 +01:00
Tobias Hunger
11d46892e4
janitor: Remove some unnecessary lazy evaluation 2022-01-04 18:22:49 +01:00
Tobias Hunger
3e448f75eb
janitor: Remove some unnecessary references
These are immediently dereferenced by the compiler according to clippy.

Remove some now unnecessary muts to make things build again.
2022-01-04 18:22:15 +01:00
Tobias Hunger
e99c1afa4b
janitor: Turn !x.is_ok() into x.is_err() 2022-01-04 18:21:36 +01:00
Tobias Hunger
06346ab2e6
janitor: Derive some Default traits 2022-01-04 18:21:25 +01:00
Tobias Hunger
c89fa46b2c
janitor: Remove some redundent clone() calls 2022-01-04 18:20:24 +01:00
Simon Hausmann
7a61d22c59 Make debug_log! work on the pico by using defmt::println!
This works like the other implementations, so it will allocate on the heap, format with core::fmt
, have no compile-time switch and not print the location.

It would be nicer to forward to defmt directly, but that means the regular
formatting wouldn't work and defmt needs to be a dependency at the call site.

For more fine-grained debugging it's easier to introduce local defmt usage.
2022-01-04 16:06:00 +01:00
Olivier Goffart
cc2a06dc07 Create an EmptyDisplay of a decent size
(The mock display is just 16x16 and nt representative of screen we want to draw on)
2022-01-04 16:06:00 +01:00
Olivier Goffart
d7911f1443 MCU: handle the scale factor 2022-01-04 16:06:00 +01:00
Simon Hausmann
93a0c5bc60 Make the mcu backend compile for the pico with the st7789 driven screen
This bundles all the board specific code in the mcu crate. There's much
to do though, so this is just a rough start and when it's all done we
should probably squash this.

Since the mcu crate dependencies require nightly and our CI builds with
stable, this removes the mcu backend from the default build and the ci.
2022-01-04 16:06:00 +01:00
Simon Hausmann
8858bf8794 Change the dummy backend in the mcu backend to render into a given DrawTarget
* This requires passing the target through a thread-local (hence the corelib export
* Also fetch the background color and resize the item to match the draw target size
* The draw target is a generic and it just needs to support convertion from rgb888
2022-01-04 16:06:00 +01:00
Olivier Goffart
0f2b9f7b78 Add a dummy "device" renderer for the MCU backend
This intends to render just one frame.
2022-01-04 16:06:00 +01:00
Simon Hausmann
dc90c5f35a Make it possible to depend on a no-std corelib
The default backend was the last crate that's in the MCU build that
would still depend default features, so remove that.
2022-01-04 16:06:00 +01:00
Olivier Goffart
f5cf60ea23 NativeComboBox: don't show the combobox as open
Because we currently don't have a way to detect when the popup is closed
we workaround the problem by never show the combo box as open.

Workaround #456
2022-01-03 12:52:20 +01:00
Tobias Hunger
597467fae9 Manually update license information in Cargo.toml files
... that are not published or private or not processed by xtask for
other reasons.
2021-12-22 10:06:12 +01:00
Tobias Hunger
bfca0e3573 Mass update copyright messages to be more REUSE compliant 2021-12-22 10:06:12 +01:00
Simon Hausmann
215cf68152 Add a simple frames per second counter to the GL and Qt backend
It can be activated using the `SIXTYFPS_DEBUG_PERFORMANCE` environment
variable, which takes a comma separated list of options.

This could be extended in the future with different locations for the
overlay (corner_top_left, corner_top_right, etc.) - but this is a simple
start.

cc #728
2021-12-20 15:32:20 +01:00
Simon Hausmann
5b31fa97a1 Fix formatting 2021-12-13 15:51:28 +01:00
Jocelyn Turcotte
93c28d12db wasm32: Fix reentrancy issues with invoke_from_event_loop
If it's called on top of the an event processed on the event loop,
it might be that GLOBAL_PROXY is already borrowed further down
the stack.
2021-12-13 15:51:28 +01:00
Simon Hausmann
d8988cae6c Prospective fix for making invoke_from_event_loop work better in WASM
When called from inside some winit event handler, we'd go straight to
`with_window_target` to get hold of the event proxy and send it. However
when called through some external event handler (DOM), the scoped
CURRENT_WINDOW_TARGET would not be set and MAYBE_LOOP_INSTANCE would
also be empty because `run` takes it. So instead we'd end up creating an
new event loop instance and the event would sit in there forever.

Instead, this change brings WASM in line with the other platforms by
using the dedicated event loop proxy (global_proxy). Because of the lack
of threading the dance of storage for that is a little different though.
2021-12-13 15:51:28 +01:00
Simon Hausmann
e0a942dc1c Avoid the use of symlinks for source files
On Windows 10, the creation of symlinks by normal users requires
enabling the developer mode, which may or may not be acceptable in
corporate environments with restricted IT setups.

We introduced the symlinks for the shared special key codes mapping,
which instead this patch places into a shared sixtyfps-common crate.
2021-12-13 15:51:10 +01:00
Simon Hausmann
2a44afebb2 Minor cleanup in GL backend
Simplify TextureCacheKey::new
2021-12-11 13:22:27 +01:00
Simon Hausmann
d1ae109296 Fix SVGs not being re-rendered when the scale factor changes
This issue was caused by two bugs:

 * The scale factor was not a property dependency of the Image cache entry's property tracker
 * The texture cache key for SVGs should include the target size that's scaled to.

Fixes #734
2021-12-10 22:26:15 +01:00
Simon Hausmann
2dae2a01d2 Internal cleanup in the GL renderer
Separate the image cache from the texture cache.
The latter needs additional data in the key. The two have less in common that it seemed.

This also fixes a small issue with `CachedImage::upload_to_gpu` that for
SVGs would return a decoded (rendered) SVG image, instead of a texture.
That was harmless because we always call `ensure_uploaded_to_gpu`
later, but now we assert that the texture cache only holds textures,
because clear() (former remove_textures()) just clears everything.
2021-12-10 22:26:15 +01:00
Olivier Goffart
733d4ed365 Handle more non printable key
Share the code that defines the key with a macro over all the backends using
a symlink.

This is a symlink rather than exposing the macro directly since we add this
module in every backend, and each backend re-declares the macro to handle
the part that it needs. This needs to be a symlink because it will also be shared
with the compiler that does not depends on sixtyfps-corelib
2021-12-10 11:28:09 +01:00
Olivier Goffart
873ab9f2e0 GL backend: fix clipping when using scale factor
The initial clipping was set in physical size rather than in logical size.
When scaling up, this does not have visible effect, but when scaling down
it clips too much.
2021-12-08 17:28:23 +01:00
Olivier Goffart
181c8aced7 GL backend: allow to override scale factor with an env variable
SIXTYFPS_SCALE_FACTOR override the scale factor at runtime
2021-12-08 17:28:23 +01:00
Lukas Jung
25dc48ae27 remove move cursor from MouseCursor 2021-12-07 22:41:24 +01:00
Lukas Jung
939b280804 Add set_mouse_cursor dummy function to mcu SimulatorWindow 2021-12-07 22:41:24 +01:00
Lukas Jung
588a7b0c5c Format mouse-cursor changes with rustfmt 2021-12-07 22:41:24 +01:00
Lukas Jung
46c34a7a7e Add empty set_mouse_cursor function to TestingWindow 2021-12-07 22:41:24 +01:00
Lukas Jung
45942fbd82 Add mouse-cursor support to qt backend 2021-12-07 22:41:24 +01:00