[reorg]: Move the rendering backends into internal

This commit is contained in:
Tobias Hunger 2022-01-31 12:37:57 +01:00 committed by Tobias Hunger
parent e6b24bceec
commit a3b86690ff
75 changed files with 77 additions and 74 deletions

View file

@ -22,17 +22,17 @@ members = [
'helper_crates/const-field-offset', 'helper_crates/const-field-offset',
'helper_crates/vtable', 'helper_crates/vtable',
'helper_crates/vtable/macro', 'helper_crates/vtable/macro',
'internal/backends/gl',
'internal/backends/mcu',
'internal/backends/qt',
'internal/backends/selector',
'internal/backends/testing',
'internal/common', 'internal/common',
'internal/compiler', 'internal/compiler',
'internal/compiler/parser_test_macro', 'internal/compiler/parser_test_macro',
'internal/core', 'internal/core',
'internal/core-macros', 'internal/core-macros',
'internal/interpreter', 'internal/interpreter',
'sixtyfps_runtime/rendering_backends/default',
'sixtyfps_runtime/rendering_backends/gl',
'sixtyfps_runtime/rendering_backends/mcu',
'sixtyfps_runtime/rendering_backends/qt',
'sixtyfps_runtime/rendering_backends/testing',
'tests/doctests', 'tests/doctests',
'tests/driver/cpp', 'tests/driver/cpp',
'tests/driver/driverlib', 'tests/driver/driverlib',
@ -57,12 +57,12 @@ default-members = [
'examples/printerdemo/rust', 'examples/printerdemo/rust',
'examples/slide_puzzle', 'examples/slide_puzzle',
'examples/todo/rust', 'examples/todo/rust',
'internal/backends/gl',
'internal/backends/qt',
'internal/backends/selector',
'internal/compiler', 'internal/compiler',
'internal/core', 'internal/core',
'internal/interpreter', 'internal/interpreter',
'sixtyfps_runtime/rendering_backends/default',
'sixtyfps_runtime/rendering_backends/gl',
'sixtyfps_runtime/rendering_backends/qt',
'tests/doctests', 'tests/doctests',
'tests/driver/interpreter', 'tests/driver/interpreter',
'tests/driver/nodejs', 'tests/driver/nodejs',

View file

@ -22,20 +22,20 @@ crate-type = ["lib", "cdylib"]
# Note, these features need to be kept in sync (along with their defaults) in # Note, these features need to be kept in sync (along with their defaults) in
# the C++ crate's CMakeLists.txt # the C++ crate's CMakeLists.txt
[features] [features]
backend-gl = ["sixtyfps-rendering-backend-default/sixtyfps-rendering-backend-gl"] backend-gl = ["sixtyfps-rendering-backend-selector/sixtyfps-rendering-backend-gl"]
backend-qt = ["sixtyfps-rendering-backend-default/sixtyfps-rendering-backend-qt"] backend-qt = ["sixtyfps-rendering-backend-selector/sixtyfps-rendering-backend-qt"]
interpreter = ["sixtyfps-interpreter"] interpreter = ["sixtyfps-interpreter"]
testing = ["sixtyfps-rendering-backend-testing"] # Enable some function used by the integration tests testing = ["sixtyfps-rendering-backend-testing"] # Enable some function used by the integration tests
wayland = ["sixtyfps-rendering-backend-default/wayland"] wayland = ["sixtyfps-rendering-backend-selector/wayland"]
x11 = ["sixtyfps-rendering-backend-default/x11"] x11 = ["sixtyfps-rendering-backend-selector/x11"]
default = ["backend-gl", "x11", "backend-qt"] default = ["backend-gl", "x11", "backend-qt"]
[dependencies] [dependencies]
sixtyfps-corelib = { version = "=0.2.0", path="../../internal/core", features = ["ffi"] } sixtyfps-corelib = { version = "=0.2.0", path="../../internal/core", features = ["ffi"] }
sixtyfps-interpreter = { version = "=0.2.0", path="../../internal/interpreter", default-features = false, features = ["ffi"], optional = true } sixtyfps-interpreter = { version = "=0.2.0", path="../../internal/interpreter", default-features = false, features = ["ffi"], optional = true }
sixtyfps-rendering-backend-default = { version = "=0.2.0", path="../../sixtyfps_runtime/rendering_backends/default" } sixtyfps-rendering-backend-selector = { version = "=0.2.0", path="../../internal/backends/selector" }
sixtyfps-rendering-backend-testing = { version = "=0.2.0", path="../../sixtyfps_runtime/rendering_backends/testing", optional = true } sixtyfps-rendering-backend-testing = { version = "=0.2.0", path="../../internal/backends/testing", optional = true }
[build-dependencies] [build-dependencies]
anyhow = "1.0" anyhow = "1.0"

View file

@ -164,7 +164,7 @@ fn gen_corelib(
.collect(); .collect();
let mut crate_dir = root_dir.to_owned(); let mut crate_dir = root_dir.to_owned();
crate_dir.extend(["sixtyfps_runtime", "corelib"].iter()); crate_dir.extend(["internal", "core"].iter());
ensure_cargo_rerun_for_crate(&crate_dir, dependencies)?; ensure_cargo_rerun_for_crate(&crate_dir, dependencies)?;
@ -431,7 +431,7 @@ fn gen_backend_qt(
); );
let mut crate_dir = root_dir.to_owned(); let mut crate_dir = root_dir.to_owned();
crate_dir.extend(["sixtyfps_runtime", "rendering_backends", "qt"].iter()); crate_dir.extend(["internal", "backends", "qt"].iter());
ensure_cargo_rerun_for_crate(&crate_dir, dependencies)?; ensure_cargo_rerun_for_crate(&crate_dir, dependencies)?;
@ -487,7 +487,7 @@ fn gen_interpreter(
.collect(); .collect();
let mut crate_dir = root_dir.to_owned(); let mut crate_dir = root_dir.to_owned();
crate_dir.extend(["sixtyfps_runtime", "interpreter"].iter()); crate_dir.extend(["internal", "interpreter"].iter());
ensure_cargo_rerun_for_crate(&crate_dir, dependencies)?; ensure_cargo_rerun_for_crate(&crate_dir, dependencies)?;
// Generate a header file with some public API (enums, etc.) // Generate a header file with some public API (enums, etc.)

View file

@ -6,14 +6,14 @@
use core::ffi::c_void; use core::ffi::c_void;
use sixtyfps_corelib::window::ffi::WindowRcOpaque; use sixtyfps_corelib::window::ffi::WindowRcOpaque;
use sixtyfps_corelib::window::WindowRc; use sixtyfps_corelib::window::WindowRc;
use sixtyfps_rendering_backend_default::backend; use sixtyfps_rendering_backend_selector::backend;
#[doc(hidden)] #[doc(hidden)]
#[cold] #[cold]
pub fn use_modules() -> usize { pub fn use_modules() -> usize {
#[cfg(feature = "sixtyfps-interpreter")] #[cfg(feature = "sixtyfps-interpreter")]
sixtyfps_interpreter::use_modules(); sixtyfps_interpreter::use_modules();
sixtyfps_rendering_backend_default::use_modules(); sixtyfps_rendering_backend_selector::use_modules();
sixtyfps_corelib::use_modules() sixtyfps_corelib::use_modules()
} }

View file

@ -17,18 +17,18 @@ keywords = ["gui", "toolkit", "graphics", "design", "ui"]
path = "lib.rs" path = "lib.rs"
[features] [features]
backend-gl = ["sixtyfps-rendering-backend-default/sixtyfps-rendering-backend-gl", "std"] backend-gl = ["sixtyfps-rendering-backend-selector/sixtyfps-rendering-backend-gl", "std"]
backend-qt = ["sixtyfps-rendering-backend-default/sixtyfps-rendering-backend-qt", "std"] backend-qt = ["sixtyfps-rendering-backend-selector/sixtyfps-rendering-backend-qt", "std"]
std = ["sixtyfps-corelib/std"] std = ["sixtyfps-corelib/std"]
wayland = ["sixtyfps-rendering-backend-default/wayland", "std"] wayland = ["sixtyfps-rendering-backend-selector/wayland", "std"]
x11 = ["sixtyfps-rendering-backend-default/x11", "std"] x11 = ["sixtyfps-rendering-backend-selector/x11", "std"]
default = ["backend-gl", "x11", "backend-qt"] default = ["backend-gl", "x11", "backend-qt"]
[dependencies] [dependencies]
sixtyfps-corelib = { version = "=0.2.0", path="../../internal/core", default-features = false } sixtyfps-corelib = { version = "=0.2.0", path="../../internal/core", default-features = false }
sixtyfps-macros = { version = "=0.2.0", path = "sixtyfps-macros" } sixtyfps-macros = { version = "=0.2.0", path = "sixtyfps-macros" }
sixtyfps-rendering-backend-default = { version = "=0.2.0", path="../../sixtyfps_runtime/rendering_backends/default" } sixtyfps-rendering-backend-selector = { version = "=0.2.0", path="../../internal/backends/selector" }
const-field-offset = { version = "0.1.2", path = "../../helper_crates/const-field-offset" } const-field-offset = { version = "0.1.2", path = "../../helper_crates/const-field-offset" }
vtable = { version = "0.1.5", path = "../../helper_crates/vtable" } vtable = { version = "0.1.5", path = "../../helper_crates/vtable" }

View file

@ -246,7 +246,7 @@ pub use sixtyfps_corelib::timers::{Timer, TimerMode};
#[doc(hidden)] #[doc(hidden)]
#[cfg(feature = "std")] #[cfg(feature = "std")]
pub fn register_font_from_memory(data: &'static [u8]) -> Result<(), Box<dyn std::error::Error>> { pub fn register_font_from_memory(data: &'static [u8]) -> Result<(), Box<dyn std::error::Error>> {
sixtyfps_rendering_backend_default::backend().register_font_from_memory(data) sixtyfps_rendering_backend_selector::backend().register_font_from_memory(data)
} }
/// This function can be used to register a custom TrueType font with SixtyFPS, /// This function can be used to register a custom TrueType font with SixtyFPS,
@ -257,7 +257,7 @@ pub fn register_font_from_memory(data: &'static [u8]) -> Result<(), Box<dyn std:
pub fn register_font_from_path<P: AsRef<std::path::Path>>( pub fn register_font_from_path<P: AsRef<std::path::Path>>(
path: P, path: P,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
sixtyfps_rendering_backend_default::backend().register_font_from_path(path.as_ref()) sixtyfps_rendering_backend_selector::backend().register_font_from_path(path.as_ref())
} }
/// internal re_exports used by the macro generated /// internal re_exports used by the macro generated
@ -299,7 +299,7 @@ pub mod re_exports {
pub use sixtyfps_corelib::ComponentVTable_static; pub use sixtyfps_corelib::ComponentVTable_static;
pub use sixtyfps_corelib::SharedString; pub use sixtyfps_corelib::SharedString;
pub use sixtyfps_corelib::SharedVector; pub use sixtyfps_corelib::SharedVector;
pub use sixtyfps_rendering_backend_default::native_widgets::*; pub use sixtyfps_rendering_backend_selector::native_widgets::*;
pub use vtable::{self, *}; pub use vtable::{self, *};
} }
@ -430,14 +430,14 @@ pub mod internal {
/// Creates a new window to render components in. /// Creates a new window to render components in.
#[doc(hidden)] #[doc(hidden)]
pub fn create_window() -> re_exports::WindowRc { pub fn create_window() -> re_exports::WindowRc {
sixtyfps_rendering_backend_default::backend().create_window() sixtyfps_rendering_backend_selector::backend().create_window()
} }
/// Enters the main event loop. This is necessary in order to receive /// Enters the main event loop. This is necessary in order to receive
/// events from the windowing system in order to render to the screen /// events from the windowing system in order to render to the screen
/// and react to user input. /// and react to user input.
pub fn run_event_loop() { pub fn run_event_loop() {
sixtyfps_rendering_backend_default::backend() sixtyfps_rendering_backend_selector::backend()
.run_event_loop(sixtyfps_corelib::backend::EventLoopQuitBehavior::QuitOnLastWindowClosed); .run_event_loop(sixtyfps_corelib::backend::EventLoopQuitBehavior::QuitOnLastWindowClosed);
} }
@ -446,7 +446,7 @@ pub fn run_event_loop() {
/// it will return immediately and once control is passed back to the event loop, /// it will return immediately and once control is passed back to the event loop,
/// the initial call to [`run_event_loop()`] will return. /// the initial call to [`run_event_loop()`] will return.
pub fn quit_event_loop() { pub fn quit_event_loop() {
sixtyfps_rendering_backend_default::backend().quit_event_loop(); sixtyfps_rendering_backend_selector::backend().quit_event_loop();
} }
/// This module contains functions useful for unit tests /// This module contains functions useful for unit tests

View file

@ -202,9 +202,9 @@ pub fn compile_with_config(
if std::env::var_os("SIXTYFPS_STYLE").is_none() && compiler_config.style.is_none() { if std::env::var_os("SIXTYFPS_STYLE").is_none() && compiler_config.style.is_none() {
compiler_config.style = std::env::var_os("OUT_DIR").and_then(|path| { compiler_config.style = std::env::var_os("OUT_DIR").and_then(|path| {
// Same logic as in sixtyfps-rendering-backend-default's build script to get the path // Same logic as in sixtyfps-rendering-backend-selector's build script to get the path
let path = Path::new(&path).parent()?.parent()?.join("SIXTYFPS_DEFAULT_STYLE.txt"); let path = Path::new(&path).parent()?.parent()?.join("SIXTYFPS_DEFAULT_STYLE.txt");
// unfortunately, if for some reason the file is changed by the sixtyfps-rendering-backend-default's build script, // unfortunately, if for some reason the file is changed by the sixtyfps-rendering-backend-selector's build script,
// it is changed after cargo decide to re-run this build script or not. So that means one will need two build // it is changed after cargo decide to re-run this build script or not. So that means one will need two build
// to settle the right thing. // to settle the right thing.
rerun_if_changed = format!("cargo:rerun-if-changed={}", path.display()); rerun_if_changed = format!("cargo:rerun-if-changed={}", path.display());

View file

@ -340,7 +340,7 @@ pub fn sixtyfps(stream: TokenStream) -> TokenStream {
CompilerConfiguration::new(sixtyfps_compilerlib::generator::OutputFormat::Rust); CompilerConfiguration::new(sixtyfps_compilerlib::generator::OutputFormat::Rust);
if std::env::var_os("SIXTYFPS_STYLE").is_none() { if std::env::var_os("SIXTYFPS_STYLE").is_none() {
// This file is written by the sixtyfps-rendering-backend-default's built script. // This file is written by the sixtyfps-rendering-backend-selector's built script.
// It is in the target/xxx/build directory // It is in the target/xxx/build directory
let target_path = match std::env::var_os("OUT_DIR") { let target_path = match std::env::var_os("OUT_DIR") {
Some(out_dir) => Some( Some(out_dir) => Some(

View file

@ -10,7 +10,11 @@ The testing instructions are in the [testing.md](./testing.md) file.
A set of crates that are somehow not strictly related to sixtyfps, and that could be moved to A set of crates that are somehow not strictly related to sixtyfps, and that could be moved to
their own repository and have their own version release at some point. their own repository and have their own version release at some point.
### `sixtyfps_compiler` ### `internal`
`internal` contains code that is not meant to be used directly by a user of sixtyfps.
#### `compiler`
The main library for the compiler for .60. The main library for the compiler for .60.
@ -19,13 +23,13 @@ Nothing in there should depends on the runtime crates.
There is a **`test`** subdirectory that contains the syntax tests. There is a **`test`** subdirectory that contains the syntax tests.
These tests allow to test the proper error conditions. These tests allow to test the proper error conditions.
### `sixtyfps_runtime` #### Runtime libraries
The library crates that are used at runtime. The library crates that are used at runtime.
* **`corelib`** is the main library. It is meant to be used for all front-ends. Ideally it should * **`core`** is the main library. It is meant to be used for all front-ends. Ideally it should
be kept as small as possible. **`corelib-macros`** contains some procedural macro used by core library. be kept as small as possible. **`corelib-macros`** contains some procedural macro used by core library.
* **`rendering_backends`** contains the different backend for the different platform, separated from * **`backends`** contains the different backend for the different platform, separated from
core library. Currently there is just the gl backend core library. Currently there is just the gl backend
* **`interpreter`** is the library used by the more dynamic languages backend to compile and * **`interpreter`** is the library used by the more dynamic languages backend to compile and
interpret .60 files. It links both against core library and the compiler lib interpret .60 files. It links both against core library and the compiler lib

View file

@ -863,4 +863,3 @@ If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the Library. permanent authorization for you to choose that version for the Library.

View file

@ -893,4 +893,3 @@ we thank the authors who made this possible:
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."

View file

@ -3,7 +3,7 @@
/*! Generated with Qt5 and /*! Generated with Qt5 and
```sh ```sh
bindgen /usr/include/qt/QtCore/qnamespace.h --whitelist-type Qt::Key --whitelist-type Qt::KeyboardModifier --whitelist-type Qt::AlignmentFlag --whitelist-type Qt::TextFlag --whitelist-type Qt::FillRule --whitelist-type Qt::CursorShape -o sixtyfps_runtime/rendering_backends/qt/key_generated.rs -- -I /usr/include/qt -xc++ bindgen /usr/include/qt/QtCore/qnamespace.h --whitelist-type Qt::Key --whitelist-type Qt::KeyboardModifier --whitelist-type Qt::AlignmentFlag --whitelist-type Qt::TextFlag --whitelist-type Qt::FillRule --whitelist-type Qt::CursorShape -o internal/backends/qt/key_generated.rs -- -I /usr/include/qt -xc++
``` ```
then add licence header and this doc then add licence header and this doc
*/ */

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial) # SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
[package] [package]
name = "sixtyfps-rendering-backend-default" name = "sixtyfps-rendering-backend-selector"
version = "0.2.0" version = "0.2.0"
authors = ["SixtyFPS <info@sixtyfps.io>"] authors = ["SixtyFPS <info@sixtyfps.io>"]
edition = "2021" edition = "2021"

View file

@ -26,7 +26,7 @@ fn main() {
let out_dir = std::env::var_os("OUT_DIR").unwrap(); let out_dir = std::env::var_os("OUT_DIR").unwrap();
// out_dir is something like // out_dir is something like
// <target_dir>/build/sixtyfps-rendering-backend-default-1fe5c4ab61eb0584/out // <target_dir>/build/sixtyfps-rendering-backend-selector-1fe5c4ab61eb0584/out
// and we want to write to a common directory, so write in the build/ dir // and we want to write to a common directory, so write in the build/ dir
let target_path = let target_path =
Path::new(&out_dir).parent().unwrap().parent().unwrap().join("SIXTYFPS_DEFAULT_STYLE.txt"); Path::new(&out_dir).parent().unwrap().parent().unwrap().join("SIXTYFPS_DEFAULT_STYLE.txt");

View file

@ -66,8 +66,9 @@ wasm-bindgen = { version = "0.2" }
web_sys = { version = "0.3", package = "web-sys", features=["console", "CanvasRenderingContext2d", "TextMetrics", "HtmlSpanElement"] } web_sys = { version = "0.3", package = "web-sys", features=["console", "CanvasRenderingContext2d", "TextMetrics", "HtmlSpanElement"] }
[dev-dependencies] [dev-dependencies]
sixtyfps = { version = "=0.2.0", path = "../../api/sixtyfps-rs", default-features = false, features = ["std"] }
sixtyfps-rendering-backend-testing = { path="../backends/testing" }
image = { version = "0.23.14", default-features = false, features = [ "png" ] } image = { version = "0.23.14", default-features = false, features = [ "png" ] }
pin-weak = "1" pin-weak = "1"
tiny-skia = "0.6.1" tiny-skia = "0.6.1"
sixtyfps = { version = "=0.2.0", path = "../../api/sixtyfps-rs", default-features = false, features = ["std"] }
sixtyfps-rendering-backend-testing = { path="../rendering_backends/testing" }

View file

@ -17,19 +17,19 @@ keywords = ["gui", "toolkit", "graphics", "design", "ui"]
path = "lib.rs" path = "lib.rs"
[features] [features]
backend-gl = ["sixtyfps-rendering-backend-default/sixtyfps-rendering-backend-gl"] backend-gl = ["sixtyfps-rendering-backend-selector/sixtyfps-rendering-backend-gl"]
backend-qt = ["sixtyfps-rendering-backend-default/sixtyfps-rendering-backend-qt"] backend-qt = ["sixtyfps-rendering-backend-selector/sixtyfps-rendering-backend-qt"]
display-diagnostics = ["sixtyfps-compilerlib/display-diagnostics"] display-diagnostics = ["sixtyfps-compilerlib/display-diagnostics"]
ffi = ["spin_on", "sixtyfps-corelib/ffi"] ffi = ["spin_on", "sixtyfps-corelib/ffi"]
wayland = ["sixtyfps-rendering-backend-default/wayland"] wayland = ["sixtyfps-rendering-backend-selector/wayland"]
x11 = ["sixtyfps-rendering-backend-default/x11"] x11 = ["sixtyfps-rendering-backend-selector/x11"]
default = ["backend-gl", "x11", "backend-qt"] default = ["backend-gl", "x11", "backend-qt"]
[dependencies] [dependencies]
sixtyfps-compilerlib = { version = "=0.2.0", path = "../compiler" } sixtyfps-compilerlib = { version = "=0.2.0", path = "../compiler" }
sixtyfps-corelib = { version = "=0.2.0", path = "../core", features = ["rtti"] } sixtyfps-corelib = { version = "=0.2.0", path = "../core", features = ["rtti"] }
sixtyfps-rendering-backend-default = { version = "=0.2.0", path = "../../sixtyfps_runtime/rendering_backends/default" } sixtyfps-rendering-backend-selector = { version = "=0.2.0", path = "../../internal/backends/selector" }
vtable = { version = "0.1.1", path="../../helper_crates/vtable" } vtable = { version = "0.1.1", path="../../helper_crates/vtable" }
@ -44,10 +44,10 @@ version = "0.1"
optional = true optional = true
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
sixtyfps-rendering-backend-gl = { version = "=0.2.0", path = "../../sixtyfps_runtime/rendering_backends/gl" } sixtyfps-rendering-backend-gl = { version = "=0.2.0", path = "../../internal/backends/gl" }
[dev-dependencies] [dev-dependencies]
sixtyfps-rendering-backend-testing = { path = "../../sixtyfps_runtime/rendering_backends/testing" } sixtyfps-rendering-backend-testing = { path = "../../internal/backends/testing" }
spin_on = "0.1" spin_on = "0.1"

View file

@ -988,7 +988,7 @@ impl ComponentHandle for ComponentInstance {
fn run(&self) { fn run(&self) {
self.show(); self.show();
sixtyfps_rendering_backend_default::backend().run_event_loop( sixtyfps_rendering_backend_selector::backend().run_event_loop(
sixtyfps_corelib::backend::EventLoopQuitBehavior::QuitOnLastWindowClosed, sixtyfps_corelib::backend::EventLoopQuitBehavior::QuitOnLastWindowClosed,
); );
self.hide(); self.hide();
@ -1057,7 +1057,7 @@ pub enum InvokeCallbackError {
/// events from the windowing system in order to render to the screen /// events from the windowing system in order to render to the screen
/// and react to user input. /// and react to user input.
pub fn run_event_loop() { pub fn run_event_loop() {
sixtyfps_rendering_backend_default::backend() sixtyfps_rendering_backend_selector::backend()
.run_event_loop(sixtyfps_corelib::backend::EventLoopQuitBehavior::QuitOnLastWindowClosed); .run_event_loop(sixtyfps_corelib::backend::EventLoopQuitBehavior::QuitOnLastWindowClosed);
} }

View file

@ -348,11 +348,11 @@ impl<'id> ComponentDescription<'id> {
#[cfg(target_arch = "wasm32")] canvas_id: String, #[cfg(target_arch = "wasm32")] canvas_id: String,
) -> vtable::VRc<ComponentVTable, ErasedComponentBox> { ) -> vtable::VRc<ComponentVTable, ErasedComponentBox> {
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
let window = sixtyfps_rendering_backend_default::backend().create_window(); let window = sixtyfps_rendering_backend_selector::backend().create_window();
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
let window = { let window = {
// Ensure that the backend is initialized // Ensure that the backend is initialized
sixtyfps_rendering_backend_default::backend(); sixtyfps_rendering_backend_selector::backend();
sixtyfps_rendering_backend_gl::create_gl_window_with_canvas_id(canvas_id) sixtyfps_rendering_backend_gl::create_gl_window_with_canvas_id(canvas_id)
}; };
self.create_with_existing_window(&window) self.create_with_existing_window(&window)
@ -688,7 +688,7 @@ pub async fn load(
{ {
if compiler_config.style.is_none() && std::env::var("SIXTYFPS_STYLE").is_err() { if compiler_config.style.is_none() && std::env::var("SIXTYFPS_STYLE").is_err() {
// Defaults to native if it exists: // Defaults to native if it exists:
compiler_config.style = Some(if sixtyfps_rendering_backend_default::HAS_NATIVE_STYLE { compiler_config.style = Some(if sixtyfps_rendering_backend_selector::HAS_NATIVE_STYLE {
"native".to_owned() "native".to_owned()
} else { } else {
"fluent".to_owned() "fluent".to_owned()
@ -758,7 +758,7 @@ pub(crate) fn generate_component<'id>(
Next::push(rtti); Next::push(rtti);
} }
} }
sixtyfps_rendering_backend_default::NativeWidgets::push(&mut rtti); sixtyfps_rendering_backend_selector::NativeWidgets::push(&mut rtti);
} }
struct TreeBuilder<'id> { struct TreeBuilder<'id> {

View file

@ -107,7 +107,7 @@ pub fn instantiate(description: &CompiledGlobal) -> (String, Pin<Rc<dyn GlobalCo
} }
} }
} }
let g = sixtyfps_rendering_backend_default::NativeGlobals::instantiate( let g = sixtyfps_rendering_backend_selector::NativeGlobals::instantiate(
element.native_class.class_name.as_ref(), element.native_class.class_name.as_ref(),
); );
(name.clone(), g) (name.clone(), g)

View file

@ -87,7 +87,7 @@ pub use api::*;
pub(crate) fn register_font_from_path<P: AsRef<std::path::Path>>( pub(crate) fn register_font_from_path<P: AsRef<std::path::Path>>(
path: P, path: P,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
sixtyfps_rendering_backend_default::backend().register_font_from_path(path.as_ref()) sixtyfps_rendering_backend_selector::backend().register_font_from_path(path.as_ref())
} }
/// (Re-export from corelib.) /// (Re-export from corelib.)

View file

@ -103,5 +103,5 @@ EOT
cargo about generate about.hbs -o $target_path/index.html cargo about generate about.hbs -o $target_path/index.html
if [ "$2x" == "--with-qtx" ]; then if [ "$2x" == "--with-qtx" ]; then
cp sixtyfps_runtime/rendering_backends/qt/LICENSE.QT sixtyfps_runtime/rendering_backends/qt/QtThirdPartySoftware_Listing.txt $target_path/ cp internal/backends/qt/LICENSE.QT internal/backends/qt/QtThirdPartySoftware_Listing.txt $target_path/
fi fi

View file

@ -7,11 +7,11 @@ cargo publish --manifest-path internal/core-macros/Cargo.toml
cargo publish --manifest-path internal/compiler/Cargo.toml cargo publish --manifest-path internal/compiler/Cargo.toml
cargo publish --manifest-path internal/core/Cargo.toml cargo publish --manifest-path internal/core/Cargo.toml
cargo publish --manifest-path api/sixtyfps-rs/sixtyfps-macros/Cargo.toml cargo publish --manifest-path api/sixtyfps-rs/sixtyfps-macros/Cargo.toml
cargo publish --manifest-path sixtyfps_runtime/rendering_backends/gl/Cargo.toml --features x11 cargo publish --manifest-path internal/backends/gl/Cargo.toml --features x11
cargo publish --manifest-path api/sixtyfps-rs/sixtyfps-build/Cargo.toml cargo publish --manifest-path api/sixtyfps-rs/sixtyfps-build/Cargo.toml
cargo publish --manifest-path sixtyfps_runtime/rendering_backends/qt/Cargo.toml cargo publish --manifest-path internal/backends/qt/Cargo.toml
sleep 30 sleep 30
cargo publish --manifest-path sixtyfps_runtime/rendering_backends/default/Cargo.toml --features x11 cargo publish --manifest-path internal/backends/selector/Cargo.toml --features x11
sleep 30 sleep 30
cargo publish --manifest-path internal/interpreter/Cargo.toml cargo publish --manifest-path internal/interpreter/Cargo.toml
cargo publish --manifest-path api/sixtyfps-rs/Cargo.toml cargo publish --manifest-path api/sixtyfps-rs/Cargo.toml

View file

@ -15,7 +15,7 @@ name = "test-driver-interpreter"
[dev-dependencies] [dev-dependencies]
sixtyfps-interpreter = { path = "../../../internal/interpreter", default-features = false, features = ["display-diagnostics"] } sixtyfps-interpreter = { path = "../../../internal/interpreter", default-features = false, features = ["display-diagnostics"] }
sixtyfps-rendering-backend-testing = { path = "../../../sixtyfps_runtime/rendering_backends/testing" } sixtyfps-rendering-backend-testing = { path = "../../../internal/backends/testing" }
itertools = "0.10" itertools = "0.10"
lazy_static = "1.4.0" lazy_static = "1.4.0"

View file

@ -18,7 +18,7 @@ build-time = ["sixtyfps-compilerlib", "spin_on"]
[dependencies] [dependencies]
sixtyfps = { path = "../../../api/sixtyfps-rs" } sixtyfps = { path = "../../../api/sixtyfps-rs" }
sixtyfps-rendering-backend-testing = { path = "../../../sixtyfps_runtime/rendering_backends/testing" } sixtyfps-rendering-backend-testing = { path = "../../../internal/backends/testing" }
[build-dependencies] [build-dependencies]
sixtyfps-compilerlib = { path = "../../../internal/compiler", features = ["rust", "display-diagnostics"], optional = true } sixtyfps-compilerlib = { path = "../../../internal/compiler", features = ["rust", "display-diagnostics"], optional = true }

View file

@ -33,7 +33,7 @@ default = ["sixtyfps-backend-qt", "sixtyfps-backend-gl", "x11"]
sixtyfps-compilerlib = { version = "=0.2.0", path = "../../internal/compiler"} sixtyfps-compilerlib = { version = "=0.2.0", path = "../../internal/compiler"}
sixtyfps-corelib = { version = "=0.2.0", path = "../../internal/core"} sixtyfps-corelib = { version = "=0.2.0", path = "../../internal/core"}
sixtyfps-interpreter = { version = "=0.2.0", path = "../../internal/interpreter", default-features = false } sixtyfps-interpreter = { version = "=0.2.0", path = "../../internal/interpreter", default-features = false }
sixtyfps-rendering-backend-default = { version = "=0.2.0", path="../../sixtyfps_runtime/rendering_backends/default" } sixtyfps-rendering-backend-selector = { version = "=0.2.0", path="../../internal/backends/selector" }
clap = { version = "3.0.5", features=["derive", "wrap_help"] } clap = { version = "3.0.5", features=["derive", "wrap_help"] }
crossbeam-channel = "0.5" # must match the version used by lsp-server crossbeam-channel = "0.5" # must match the version used by lsp-server

View file

@ -46,7 +46,7 @@ unsafe impl Sync for FutureRunner {}
impl Wake for FutureRunner { impl Wake for FutureRunner {
fn wake(self: Arc<Self>) { fn wake(self: Arc<Self>) {
sixtyfps_rendering_backend_default::backend().post_event(Box::new(move || { sixtyfps_rendering_backend_selector::backend().post_event(Box::new(move || {
let waker = self.clone().into(); let waker = self.clone().into();
let mut cx = std::task::Context::from_waker(&waker); let mut cx = std::task::Context::from_waker(&waker);
let mut fut_opt = self.fut.lock().unwrap(); let mut fut_opt = self.fut.lock().unwrap();
@ -91,7 +91,7 @@ pub fn start_ui_event_loop() {
if *state_requested == RequestedGuiEventLoopState::StartLoop { if *state_requested == RequestedGuiEventLoopState::StartLoop {
// Send an event so that once the loop is started, we notify the LSP thread that it can send more events // Send an event so that once the loop is started, we notify the LSP thread that it can send more events
sixtyfps_rendering_backend_default::backend().post_event(Box::new(|| { sixtyfps_rendering_backend_selector::backend().post_event(Box::new(|| {
let mut state_request = GUI_EVENT_LOOP_STATE_REQUEST.lock().unwrap(); let mut state_request = GUI_EVENT_LOOP_STATE_REQUEST.lock().unwrap();
if *state_request == RequestedGuiEventLoopState::StartLoop { if *state_request == RequestedGuiEventLoopState::StartLoop {
*state_request = RequestedGuiEventLoopState::LoopStated; *state_request = RequestedGuiEventLoopState::LoopStated;
@ -101,7 +101,7 @@ pub fn start_ui_event_loop() {
} }
} }
sixtyfps_rendering_backend_default::backend() sixtyfps_rendering_backend_selector::backend()
.run_event_loop(sixtyfps_corelib::backend::EventLoopQuitBehavior::QuitOnlyExplicitly); .run_event_loop(sixtyfps_corelib::backend::EventLoopQuitBehavior::QuitOnlyExplicitly);
} }
@ -114,8 +114,8 @@ pub fn quit_ui_event_loop() {
GUI_EVENT_LOOP_NOTIFIER.notify_one(); GUI_EVENT_LOOP_NOTIFIER.notify_one();
} }
sixtyfps_rendering_backend_default::backend().post_event(Box::new(|| { sixtyfps_rendering_backend_selector::backend().post_event(Box::new(|| {
sixtyfps_rendering_backend_default::backend().quit_event_loop(); sixtyfps_rendering_backend_selector::backend().quit_event_loop();
})); }));
// Make sure then sender channel gets dropped // Make sure then sender channel gets dropped

View file

@ -24,7 +24,7 @@ default = ["sixtyfps-backend-qt", "sixtyfps-backend-gl", "x11"]
[dependencies] [dependencies]
sixtyfps-corelib = { version = "=0.2.0", path="../../internal/core" } sixtyfps-corelib = { version = "=0.2.0", path="../../internal/core" }
sixtyfps-interpreter = { version = "=0.2.0", path = "../../internal/interpreter", default-features = false, features = ["display-diagnostics"] } sixtyfps-interpreter = { version = "=0.2.0", path = "../../internal/interpreter", default-features = false, features = ["display-diagnostics"] }
sixtyfps-rendering-backend-default = { version = "=0.2.0", path="../../sixtyfps_runtime/rendering_backends/default" } sixtyfps-rendering-backend-selector = { version = "=0.2.0", path="../../internal/backends/selector" }
vtable = { version = "0.1", path="../../helper_crates/vtable" } vtable = { version = "0.1", path="../../helper_crates/vtable" }

View file

@ -193,7 +193,7 @@ fn init_dialog(instance: &ComponentInstance) {
instance instance
.set_callback(&cb, move |_| { .set_callback(&cb, move |_| {
EXIT_CODE.store(exit_code, std::sync::atomic::Ordering::Relaxed); EXIT_CODE.store(exit_code, std::sync::atomic::Ordering::Relaxed);
sixtyfps_rendering_backend_default::backend().quit_event_loop(); sixtyfps_rendering_backend_selector::backend().quit_event_loop();
Default::default() Default::default()
}) })
.unwrap(); .unwrap();
@ -348,7 +348,7 @@ unsafe impl Sync for FutureRunner {}
impl Wake for FutureRunner { impl Wake for FutureRunner {
fn wake(self: Arc<Self>) { fn wake(self: Arc<Self>) {
sixtyfps_rendering_backend_default::backend().post_event(Box::new(move || { sixtyfps_rendering_backend_selector::backend().post_event(Box::new(move || {
let waker = self.clone().into(); let waker = self.clone().into();
let mut cx = std::task::Context::from_waker(&waker); let mut cx = std::task::Context::from_waker(&waker);
let mut fut_opt = self.fut.lock().unwrap(); let mut fut_opt = self.fut.lock().unwrap();