summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--native/src/window.rs23
-rw-r--r--runtime/Cargo.toml (renamed from native/Cargo.toml)2
-rw-r--r--runtime/README.md (renamed from native/README.md)0
-rw-r--r--runtime/src/clipboard.rs (renamed from native/src/clipboard.rs)15
-rw-r--r--runtime/src/command.rs (renamed from native/src/command.rs)0
-rw-r--r--runtime/src/command/action.rs (renamed from native/src/command/action.rs)0
-rw-r--r--runtime/src/debug/basic.rs (renamed from native/src/debug/basic.rs)0
-rw-r--r--runtime/src/debug/null.rs (renamed from native/src/debug/null.rs)0
-rw-r--r--runtime/src/font.rs (renamed from native/src/font.rs)0
-rw-r--r--runtime/src/keyboard.rs (renamed from native/src/keyboard.rs)0
-rw-r--r--runtime/src/lib.rs (renamed from native/src/lib.rs)0
-rw-r--r--runtime/src/program.rs (renamed from native/src/program.rs)0
-rw-r--r--runtime/src/program/state.rs (renamed from native/src/program/state.rs)0
-rw-r--r--runtime/src/system.rs (renamed from native/src/system.rs)0
-rw-r--r--runtime/src/system/action.rs (renamed from native/src/system/action.rs)0
-rw-r--r--runtime/src/system/information.rs (renamed from native/src/system/information.rs)0
-rw-r--r--runtime/src/user_interface.rs (renamed from native/src/user_interface.rs)24
-rw-r--r--runtime/src/window/action.rs (renamed from native/src/window/action.rs)0
18 files changed, 27 insertions, 37 deletions
diff --git a/native/src/window.rs b/native/src/window.rs
deleted file mode 100644
index aa3f35c7..00000000
--- a/native/src/window.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-//! Build window-based GUI applications.
-mod action;
-
-pub use action::Action;
-
-use crate::core::time::Instant;
-use crate::core::window::Event;
-use crate::futures::subscription::{self, Subscription};
-
-/// Subscribes to the frames of the window of the running application.
-///
-/// The resulting [`Subscription`] will produce items at a rate equal to the
-/// refresh rate of the window. Note that this rate may be variable, as it is
-/// normally managed by the graphics driver and/or the OS.
-///
-/// In any case, this [`Subscription`] is useful to smoothly draw application-driven
-/// animations without missing any frames.
-pub fn frames() -> Subscription<Instant> {
- subscription::raw_events(|event, _status| match event {
- iced_core::Event::Window(Event::RedrawRequested(at)) => Some(at),
- _ => None,
- })
-}
diff --git a/native/Cargo.toml b/runtime/Cargo.toml
index bc4e7ca1..2d3e8db3 100644
--- a/native/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "iced_native"
+name = "iced_runtime"
version = "0.9.1"
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
edition = "2021"
diff --git a/native/README.md b/runtime/README.md
index 996daa76..996daa76 100644
--- a/native/README.md
+++ b/runtime/README.md
diff --git a/native/src/clipboard.rs b/runtime/src/clipboard.rs
index e727c4a7..bc450912 100644
--- a/native/src/clipboard.rs
+++ b/runtime/src/clipboard.rs
@@ -1,5 +1,6 @@
//! Access the clipboard.
-use iced_futures::MaybeSend;
+use crate::command::{self, Command};
+use crate::futures::MaybeSend;
use std::fmt;
@@ -38,3 +39,15 @@ impl<T> fmt::Debug for Action<T> {
}
}
}
+
+/// Read the current contents of the clipboard.
+pub fn read<Message>(
+ f: impl Fn(Option<String>) -> Message + 'static,
+) -> Command<Message> {
+ Command::single(command::Action::Clipboard(Action::Read(Box::new(f))))
+}
+
+/// Write the given contents to the clipboard.
+pub fn write<Message>(contents: String) -> Command<Message> {
+ Command::single(command::Action::Clipboard(Action::Write(contents)))
+}
diff --git a/native/src/command.rs b/runtime/src/command.rs
index cd4c51ff..cd4c51ff 100644
--- a/native/src/command.rs
+++ b/runtime/src/command.rs
diff --git a/native/src/command/action.rs b/runtime/src/command/action.rs
index 6c74f0ef..6c74f0ef 100644
--- a/native/src/command/action.rs
+++ b/runtime/src/command/action.rs
diff --git a/native/src/debug/basic.rs b/runtime/src/debug/basic.rs
index 32f725a1..32f725a1 100644
--- a/native/src/debug/basic.rs
+++ b/runtime/src/debug/basic.rs
diff --git a/native/src/debug/null.rs b/runtime/src/debug/null.rs
index 2db0eebb..2db0eebb 100644
--- a/native/src/debug/null.rs
+++ b/runtime/src/debug/null.rs
diff --git a/native/src/font.rs b/runtime/src/font.rs
index 15359694..15359694 100644
--- a/native/src/font.rs
+++ b/runtime/src/font.rs
diff --git a/native/src/keyboard.rs b/runtime/src/keyboard.rs
index 012538e3..012538e3 100644
--- a/native/src/keyboard.rs
+++ b/runtime/src/keyboard.rs
diff --git a/native/src/lib.rs b/runtime/src/lib.rs
index aa45e57a..aa45e57a 100644
--- a/native/src/lib.rs
+++ b/runtime/src/lib.rs
diff --git a/native/src/program.rs b/runtime/src/program.rs
index 44585cc5..44585cc5 100644
--- a/native/src/program.rs
+++ b/runtime/src/program.rs
diff --git a/native/src/program/state.rs b/runtime/src/program/state.rs
index 2fa9934d..2fa9934d 100644
--- a/native/src/program/state.rs
+++ b/runtime/src/program/state.rs
diff --git a/native/src/system.rs b/runtime/src/system.rs
index 61c8ff29..61c8ff29 100644
--- a/native/src/system.rs
+++ b/runtime/src/system.rs
diff --git a/native/src/system/action.rs b/runtime/src/system/action.rs
index dea9536f..dea9536f 100644
--- a/native/src/system/action.rs
+++ b/runtime/src/system/action.rs
diff --git a/native/src/system/information.rs b/runtime/src/system/information.rs
index 93e7a5a4..93e7a5a4 100644
--- a/native/src/system/information.rs
+++ b/runtime/src/system/information.rs
diff --git a/native/src/user_interface.rs b/runtime/src/user_interface.rs
index 315027fa..2c76fd8a 100644
--- a/native/src/user_interface.rs
+++ b/runtime/src/user_interface.rs
@@ -32,7 +32,7 @@ pub struct UserInterface<'a, Message, Renderer> {
impl<'a, Message, Renderer> UserInterface<'a, Message, Renderer>
where
- Renderer: iced_core::Renderer,
+ Renderer: crate::core::Renderer,
{
/// Builds a user interface for an [`Element`].
///
@@ -46,7 +46,7 @@ where
///
/// ```no_run
/// # mod iced_wgpu {
- /// # pub use iced_native::core::renderer::Null as Renderer;
+ /// # pub use iced_runtime::core::renderer::Null as Renderer;
/// # }
/// #
/// # pub struct Counter;
@@ -56,8 +56,8 @@ where
/// # pub fn view(&self) -> iced_core::Element<(), Renderer> { unimplemented!() }
/// # pub fn update(&mut self, _: ()) {}
/// # }
- /// use iced_native::core::Size;
- /// use iced_native::user_interface::{self, UserInterface};
+ /// use iced_runtime::core::Size;
+ /// use iced_runtime::user_interface::{self, UserInterface};
/// use iced_wgpu::Renderer;
///
/// // Initialization
@@ -119,7 +119,7 @@ where
///
/// ```no_run
/// # mod iced_wgpu {
- /// # pub use iced_native::core::renderer::Null as Renderer;
+ /// # pub use iced_runtime::core::renderer::Null as Renderer;
/// # }
/// #
/// # pub struct Counter;
@@ -129,8 +129,8 @@ where
/// # pub fn view(&self) -> iced_core::Element<(), Renderer> { unimplemented!() }
/// # pub fn update(&mut self, _: ()) {}
/// # }
- /// use iced_native::core::{clipboard, Size, Point};
- /// use iced_native::user_interface::{self, UserInterface};
+ /// use iced_runtime::core::{clipboard, Size, Point};
+ /// use iced_runtime::user_interface::{self, UserInterface};
/// use iced_wgpu::Renderer;
///
/// let mut counter = Counter::new();
@@ -348,7 +348,7 @@ where
///
/// ```no_run
/// # mod iced_wgpu {
- /// # pub use iced_native::core::renderer::Null as Renderer;
+ /// # pub use iced_runtime::core::renderer::Null as Renderer;
/// # pub type Theme = ();
/// # }
/// #
@@ -359,10 +359,10 @@ where
/// # pub fn view(&self) -> Element<(), Renderer> { unimplemented!() }
/// # pub fn update(&mut self, _: ()) {}
/// # }
- /// use iced_native::core::clipboard;
- /// use iced_native::core::renderer;
- /// use iced_native::core::{Element, Size, Point};
- /// use iced_native::user_interface::{self, UserInterface};
+ /// use iced_runtime::core::clipboard;
+ /// use iced_runtime::core::renderer;
+ /// use iced_runtime::core::{Element, Size, Point};
+ /// use iced_runtime::user_interface::{self, UserInterface};
/// use iced_wgpu::{Renderer, Theme};
///
/// let mut counter = Counter::new();
diff --git a/native/src/window/action.rs b/runtime/src/window/action.rs
index c1dbd84f..c1dbd84f 100644
--- a/native/src/window/action.rs
+++ b/runtime/src/window/action.rs