Commit graph

651 commits

Author SHA1 Message Date
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
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
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
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
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
588a7b0c5c Format mouse-cursor changes with rustfmt 2021-12-07 22:41:24 +01:00
Lukas Jung
cea17c1958 Add mouse-cursor support to glwindow backend 2021-12-07 22:41:24 +01:00
Olivier Goffart
c964696e24 Bump winit version 2021-12-07 14:28:31 +01:00
Simon Hausmann
957186acb7 Fix drop shadow offset handling with the GL renderer
The cached shadow image should just be the cache of the shadow. This
removes a visible "edge" from the shadow sometimes and brings the
rendering in line with the Qt backend.
2021-12-07 13:06:31 +01:00
Simon Hausmann
6ca63aac9c Make it possible to delegate the timer handling to the backend
When building with no_std, the backend can provide the global
instant.
2021-11-30 17:27:55 +01:00
ogoffart
3278b39549 Bump version number to 0.1.6 2021-11-24 14:19:09 +00:00
Olivier Goffart
d1cae710df preprocess the images at compile time
For the MCU port, we need to proccess the image to save them in the binary
in a convenient format.
This patch start this work by trying to anaylyze what format should an image
be using, and saving it as a texture in the binary.

The current graphical backend and the C++ frontend are not yet supported
2021-11-19 15:54:45 +01:00
Simon Hausmann
b29b2cfaea Make WinitWindow::apply_window_properties work outside the GL backend crate
Move the image loading related bit for the icon back into glwindow.

Amends commit
51469be56b.
2021-11-12 11:44:39 +01:00
Simon Hausmann
e3ee59fd13 Fix transitioning from fixed size to resizable window with the GL backend
PR #642 fixed making the window not resizable when it has initially a
fixed size. This change applies a different logic with the same
resulting effect when the window item changes later, for example when
transiting in the live-preview from a fixed size to a resizable window -
by looking at the min/max constraints.
2021-11-12 09:06:35 +01:00
Simon Hausmann
51469be56b Move more of the winit related code from PlatformWindow impl into WinitWindow
This will allow code sharing with the simulator in the future.
2021-11-12 09:02:52 +01:00
Simon Hausmann
68ec3ccf6f GL backend cleanup
Move the window constraint application handling into WinitWindow,
for future sharing.
2021-11-11 11:47:54 +01:00
Simon Hausmann
8de52f1b70 GL backend cleanup
Move the OpenGLContext helper into a module of its own, for future sharing.
2021-11-11 11:47:54 +01:00
Simon Hausmann
ad1b251966 Internal cleanup
Centralize the setting of the width/height on the window item in the core library.
2021-11-11 11:47:54 +01:00
Simon Hausmann
1fb101c0a0 GL window cleanup
Remove internal component() function. There was only one call site.
2021-11-11 11:47:54 +01:00
Simon Hausmann
6fe9c3c23c GL window cleanup
Inline map_window() and unmap_window()
2021-11-11 11:47:52 +01:00
Simon Hausmann
3c0607276c Make the GL backends' winit driven event loop a reusable module
Abstract away the dependency to the former GraphicsWindow by

(1) Renaming GraphicsWindow to GLWindow
(2) Introducing a WinitWindow trait
2021-11-11 11:45:56 +01:00
Aursen
bd613219ba Refactoring code 2021-11-11 11:45:37 +01:00
Aursen
ceb8ed626c Fix previous error 2021-11-11 11:45:37 +01:00
Aursen
2962da65a4 Fix the maximization button with a fixed inner size 2021-11-11 11:45:37 +01:00
Philipp Gesang
cd3717af9a handle tab keycode in backend
Treating the Tab key as text disallows handling Shift-Tab because
the shift modifier will not be passed down. This makes the
handling of Tab analogous to Escape, Return and other non-text
keycodes.
2021-11-08 16:04:37 +01:00
Simon Hausmann
67579ec560 Simplify drop implementation of generated components
Avoid creating an intermediate array of items to free the graphics resources.
Instead call run-time function with the item tree as a parameter, which is traversed.

It's practically the same data structure that was previously created, except
that it is shared/global and has little holes for the dynamic tree items, but those are easy to skip.
2021-11-01 08:58:53 +01:00
Simon Hausmann
d57edfbb7c Simplify free_graphics_resources API in the backend
Take an iterator reference instead of a slice, so that we can change the call sites in the future.
2021-10-30 13:03:52 +02:00
ogoffart
b25ae6fbcd Bump version number to 0.1.5 2021-10-26 07:36:54 +00:00
Olivier Goffart
68797dd0d4 Make sure to specify a high enough version for the rgb crate
There were security issues reported in previous version
2021-10-21 12:44:06 +02:00
Olivier Goffart
cc1205742d Move the image dependency down in the dependency tree
Corelib only need the image crate for doc test
the Qt bakcned don't use the image crate
2021-10-21 12:42:04 +02:00
Olivier Goffart
56d592100e Update a few dependencies 2021-10-21 12:24:48 +02:00
Robert Broketa
938252d740 Not set bordeless/frameless mode if fullscreen 2021-10-11 10:21:21 +02:00