Commit 5a04d26b authored by Florian Blasius's avatar Florian Blasius 🤘

Rest dependencies to fix Redox build.

parent 77e996d0
......@@ -15,6 +15,15 @@
"rust"
]
},
{
"name": "Widgets web",
"type": "firefox",
"request": "launch",
"reAttach": true,
"preLaunchTask": "build-web",
"url": "http://localhost:8000",
},
{
"type": "lldb",
"request": "launch",
......
......@@ -39,6 +39,28 @@
"kind": "build",
"isDefault": true
}
}
},
{
"label": "build-web",
"command": "cargo",
"type": "shell",
"args": [
"web",
"start",
"--target=wasm32-unknown-unknown",
"--auto-reload",
"--example",
"widgets"
],
"presentation": {
"reveal": "always",
"panel": "new"
},
"group": {
"kind": "build",
"isDefault": true
}
},
]
}
\ No newline at end of file
......@@ -458,6 +458,15 @@ dependencies = [
"stdweb 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "orbgl_web"
version = "0.1.0"
source = "git+https://gitlab.redox-os.org/redox-os/orbgl.git#715fc579acf3cc2b449bf54f5cf3e4667bd82a93"
dependencies = [
"orbgl_api 0.1.0 (git+https://gitlab.redox-os.org/redox-os/orbgl.git)",
"stdweb 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "orbimage"
version = "0.1.17"
......@@ -502,7 +511,9 @@ dependencies = [
"orbfont 0.1.9 (git+https://gitlab.redox-os.org/redox-os/orbfont.git)",
"orbgl 0.1.0 (git+https://gitlab.redox-os.org/redox-os/orbgl.git)",
"orbgl_api 0.1.0 (git+https://gitlab.redox-os.org/redox-os/orbgl.git)",
"orbgl_web 0.1.0 (git+https://gitlab.redox-os.org/redox-os/orbgl.git)",
"orbtk-utils 0.1.0",
"stdweb 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
......@@ -1164,6 +1175,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum orbfont 0.1.9 (git+https://gitlab.redox-os.org/redox-os/orbfont.git)" = "<none>"
"checksum orbgl 0.1.0 (git+https://gitlab.redox-os.org/redox-os/orbgl.git)" = "<none>"
"checksum orbgl_api 0.1.0 (git+https://gitlab.redox-os.org/redox-os/orbgl.git)" = "<none>"
"checksum orbgl_web 0.1.0 (git+https://gitlab.redox-os.org/redox-os/orbgl.git)" = "<none>"
"checksum orbimage 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "39fe3f9612b797a312bf122a67ebce408936b34996b9be419dbf0b3d4638c424"
"checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518"
"checksum phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18"
......
......@@ -8,6 +8,10 @@ license = "MIT"
keywords = ["shell", "window", "ui"]
edition = "2018"
[target.'cfg(target_arch = "wasm32")'.dependencies]
orbgl_web = { git = "https://gitlab.redox-os.org/redox-os/orbgl.git" }
stdweb = "0.4.17"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
orbgl = { git = "https://gitlab.redox-os.org/redox-os/orbgl.git" }
orbfont = { git = "https://gitlab.redox-os.org/redox-os/orbfont.git" }
......
......@@ -27,8 +27,6 @@ runner.run()
*/
#[macro_use]
extern crate lazy_static;
......@@ -41,3 +39,6 @@ pub mod window;
#[path = "orbclient/mod.rs"]
pub mod platform;
#[cfg(target_arch = "wasm32")]
#[path = "web/mod.rs"]
pub mod platform;
//! This module contains a platform specific implementation of the window shell.
use std::{cell::{Cell, RefCell}, collections::HashMap, rc::Rc, sync::Arc};
use orbgl_api::Canvas;
use orbtk_utils::{Point, Rect};
use crate::{obsolete, prelude::*};
/// Concrete implementation of the window shell.
pub struct WindowShell<A> where A: WindowAdapter {
}
impl<A> WindowShell<A> where A: WindowAdapter {
/// Creates a new window shell with an adapter.
pub fn new(adapter: A) -> WindowShell<A> {
WindowShell {
adapter,
}
}
/// Gets the shell adapter.
pub fn adapter(&mut self) -> &mut A {
&mut self.adapter
}
fn drain_events(&mut self) {
}
}
// impl<A> Drop for WindowShell<A> where A: WindowAdapter {
// fn drop(&mut self) {
// self.inner.sync();
// }
// }
/// Implementation of the OrbClient based backend runner.
pub struct ShellRunner<A> where A: WindowAdapter {
pub window_shell: Rc<RefCell<WindowShell<A>>>,
pub update: Rc<Cell<bool>>,
pub running: Rc<Cell<bool>>,
pub updater: Box<Updater>,
}
impl<A> ShellRunner<A> where A: WindowAdapter {
pub fn run(&mut self) {
// loop {
// if !self.running.get() {
// break;
// }
// self.updater.update();
// self.update.set(false);
// self.window_shell.borrow_mut().drain_events();
// }
}
}
/// Constructs the window shell
pub struct WindowBuilder<A> where A: WindowAdapter {
title: String,
resizeable: bool,
bounds: Rect,
adapter: A,
}
impl<A> WindowBuilder<A> where A: WindowAdapter {
/// Create a new window builder with the given adapter.
pub fn new(adapter: A) -> Self {
WindowBuilder {
adapter,
title: String::default(),
resizeable: false,
bounds: Rect::default(),
}
}
/// Sets the title.
pub fn title(mut self, title: impl Into<String>) -> Self {
self.title = title.into();
self
}
/// Sets resizeable.
pub fn resizeable(mut self, resizeable: bool) -> Self {
self.resizeable = resizeable;
self
}
/// Sets the bounds.
pub fn bounds(mut self, bounds: impl Into<Rect>) -> Self {
self.bounds = bounds.into();
self
}
/// Builds the window shell.
pub fn build(self) -> WindowShell<A> {
let mut flags = vec![];
if self.resizeable {
flags.push(WindowFlag::Resizable);
}
WindowShell::new(
// Window::new_flags(
// self.bounds.x as i32,
// self.bounds.y as i32,
// self.bounds.width as u32,
// self.bounds.height as u32,
// &self.title,
// &flags,
// ).unwrap(),
self.adapter,
)
}
}
// --- obsolete will be removed after OrbGL supports text rendering ---
// --- obsolete will be removed after OrbGL supports text rendering ---
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment