Commit 5f25fcc1 authored by Florian Blasius's avatar Florian Blasius 🤘
Browse files

Add send to window implementations.

parent 7f7f28d9
......@@ -7,8 +7,6 @@ use std::sync::Arc;
fn main() {
orbrender::initialize();
// todo add render dings with usize index
#[cfg(target_arch = "wasm32")]
let res_path = "res/";
......
......@@ -64,6 +64,8 @@ pub struct CairoWindow {
left_pressed: bool,
}
unsafe impl Send for CairoWindow {}
impl Window for CairoWindow {
fn size(&self) -> Size {
Size::new(
......@@ -95,8 +97,6 @@ impl Window for CairoWindow {
|| border_thickness.right > 0.0
|| border_thickness.bottom > 0.0
{
// todo: use border_thickness
if let Some(border_color) = rectangle.border_color {
if rectangle.radius > 0.0 {
rounded_rect(
......
......@@ -46,7 +46,6 @@ impl Window for OrbClientWindow {
|| border_thickness.right > 0.0
|| border_thickness.bottom > 0.0
{
// todo: use border_thickness
if let Some(border_color) = rectangle.border_color {
if rectangle.radius > 0.0 {
self.inner_window.rounded_rect(
......
pub struct Runner {
run: Box<FnMut() -> bool>,
run: Box<FnMut() -> bool + Send>,
}
impl Runner {
pub fn new(run: Box<FnMut() -> bool>) -> Self {
pub fn new(run: Box<FnMut() -> bool + Send>) -> Self {
Runner {
run
}
......
......@@ -65,6 +65,8 @@ pub struct StdWebWindow {
events: Rc<RefCell<Vec<Event>>>,
}
unsafe impl Send for StdWebWindow {}
//impl StdWebWindow {
// fn register_event_handlers(&self, canvas: CanvasElement, events: Rc<RefCell<Event>>) {
//
......
......@@ -4,7 +4,7 @@ use crate::{
structs::{Color, Size},
};
pub trait Window {
pub trait Window : Send {
/// Returns the size of the window.
fn size(&self) -> Size;
......
use crate::{
backend::{self, build_window},
backend::build_window,
enums::WindowMode,
structs::{Color, Icon, Size},
traits::Window,
......@@ -38,7 +38,7 @@ impl Default for WindowBuilder {
impl WindowBuilder {
/// Initializes a new `WindowBuilder` with default values.
pub fn new() -> WindowBuilder {
pub fn new() -> Self {
WindowBuilder::default()
}
......
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