Commit graph

946 commits

Author SHA1 Message Date
Olivier Goffart
691d43d416 MCU backend: build with no_std 2021-11-30 21:33:32 +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
Olivier Goffart
6004c4ee2f Make the std feature optional in sixtyfps-rs
And tweak the MCU backend dependencie
2021-11-30 15:48:05 +01:00
Simon Hausmann
8f4b256da0 Fix components being inadvertendly shown when using Qt
Remove a spurious show() call, only an explicit show() should bring up the widget on the screen.
2021-11-30 12:31:51 +01:00
Simon Hausmann
6233cc64f2 Fix build with Qt 5
The QPalette workaround is only needed for Qt 6.
2021-11-29 17:18:23 +01:00
Simon Hausmann
e512feb952 Fix reacting to palette changes when using Qt
Due to a bug in Qt's implicit sharing in QPalette, the resolve mask of
QGuiApplicationPrivate::app_pal would get changed with an unrelated setColor
call and thus break color resolution from a new base palette when the theme changes.
2021-11-29 17:18:23 +01:00
Olivier Goffart
e4bd6bbfb8 Native style: respond to the StyleChange event
So that color scheme is updated when switching to the dark style, for example

Fixes #687
2021-11-29 17:18:23 +01:00
Olivier Goffart
80c0602277 WIP: start making the corelib crate a no_std crate
Does not compile yet with no_std because of the lack of
alternative for thread_local
2021-11-25 12:02:16 +01:00
ogoffart
3278b39549 Bump version number to 0.1.6 2021-11-24 14:19:09 +00:00
Olivier Goffart
3e3e98725f Fix build
apparently there was Some issue while rebasing
2021-11-22 17:57:08 +01:00
Olivier Goffart
20f41a681b MCU: Render line by line in a line buffer 2021-11-22 17:15:28 +01:00
Simon Hausmann
2753186f3a Fix CI build
Comment out unused z field in the MCU renderer
2021-11-22 14:36:12 +01:00
Olivier Goffart
6a17ae3328 MCU: Dasic support for image drawing 2021-11-22 13:51:22 +01:00
Olivier Goffart
5c9c5c2748 WIP: work on the MCU rendering engine 2021-11-22 13:51:22 +01:00
Olivier Goffart
a40885b39e MCI: small changes required to run an (empty) windows for the compiled printerdemo 2021-11-19 16:03:38 +01: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
d539d4be79 Naive implementation of the window background item for the simulator 2021-11-19 15:02:52 +01:00
Simon Hausmann
abb423ed33 Initial commit for a new software rendering backend for use in MCUs
This adds the skeleton, including a winit driven simulator window
and a dummy ItemRenderer implementation.
2021-11-19 15:02:52 +01:00
Simon Hausmann
8f940a446e Make it possible to opt out of the default rendering backend selection
The default backend does not select any features or backends by default
on the Cargo.toml feature level. And with this change it also doesn't do
that anymore based on the target platform.

That means if the rust api crate is built with default-features = false,
no backend will be selected and the user has to take care of backend
initialization through other means.

The feature defaults, generally, are in the rust API crate, the
interpreter crate and C++ CMakeLists.txt. The latter triggers a cargo
build of sixtyfps-cpp with --no-default-features. However the cpp_test
job in the CI doesn't build sixtyfps-cpp with CMake but instead calls
cargo directly. Therefore the defaults are now also coded in the
sixtyfps-cpp Cargo.toml, to ensure that *a* rendering backend is chosen
(since the cfg.target bit is gone).
2021-11-19 15:02:52 +01:00
Olivier Goffart
f138887857 QPainter and QBrush are now exposed by qttypes 0.2.5 2021-11-19 12:43:47 +01:00
Olivier Goffart
cd14e1d70c Move the NativeButtonVTable in the right module 2021-11-18 10:23:06 +01:00
unc0
54ae34f9fb Set MSVC to use UTF-8 character sets on c++ source files,
so it won't throw error on `u"string"` when running in
other codepage, for example cp936.
Ref: https://docs.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8
2021-11-17 19:35:12 +01:00
Olivier Goffart
becb4574c1 Qt backend: don't set Qt::AA_PluginApplication when using the backend
Otherwise Qt won't set the hidpi mode on windows, for example
2021-11-17 09:05:24 +01:00
Olivier Goffart
40a6f3e740 Polish the Native Spinbox: There is a line edit that need to be drawn inside 2021-11-17 08:44:08 +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
Olivier Goffart
28c485c161 Handle the tab key in the Qt backend
Completes #639
2021-11-08 16:16:56 +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
13de800ba3 Internal cleanup: Rename layouting_info to layout_info
That's making the call on the Component VTable consistent(ish) with the Item VTable.
2021-11-08 10:24:30 +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
Simon Hausmann
6671aaefcc Remove unnecessary weak-table dependency 2021-10-25 14:56:33 +02:00
Olivier Goffart
18ce1087d5 Hardcode the Qt license
Because the install qt github action does not install the documentation
2021-10-22 14:32:17 +02:00
Olivier Goffart
38c726ad4f We need to enable the png feature in the test backend 2021-10-21 13:10:22 +02: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
Simon Hausmann
dec6c6ca51 Work around crash in Qt mac style when drawing scrollbars with invalid size
Fixes #595
2021-10-19 12:36:26 +02:00
Olivier Goffart
4436b422e5 Fix LineEdit.has-focus witht he native style
The property had the wrong name.

Also it is not a native-output
2021-10-14 15:34:25 +02:00