summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Bingus <shankern@protonmail.com>2023-02-20 10:04:36 -0800
committerLibravatar Bingus <shankern@protonmail.com>2023-02-20 10:04:36 -0800
commit9565b477ca66ef33bf3869361b838275e411ca75 (patch)
tree490f76407909300301cbfda0bda57676fd48882a /native
parent3aaf5d8873b16302badb14dc5508329c943862fb (diff)
parent8c83d40e115a182136acfe013baa7a3f795ba3a5 (diff)
downloadiced-9565b477ca66ef33bf3869361b838275e411ca75.tar.gz
iced-9565b477ca66ef33bf3869361b838275e411ca75.tar.bz2
iced-9565b477ca66ef33bf3869361b838275e411ca75.zip
Merge remote-tracking branch 'origin/master' into feat/multi-window-support
Diffstat (limited to '')
-rw-r--r--native/Cargo.toml8
-rw-r--r--native/README.md2
-rw-r--r--native/src/image.rs6
-rw-r--r--native/src/lib.rs4
-rw-r--r--native/src/overlay/menu.rs3
-rw-r--r--native/src/subscription.rs2
-rw-r--r--native/src/user_interface.rs17
-rw-r--r--native/src/widget.rs10
-rw-r--r--native/src/widget/pane_grid.rs2
-rw-r--r--native/src/widget/slider.rs4
-rw-r--r--native/src/widget/vertical_slider.rs4
11 files changed, 32 insertions, 30 deletions
diff --git a/native/Cargo.toml b/native/Cargo.toml
index 79e4dac4..3f92783e 100644
--- a/native/Cargo.toml
+++ b/native/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "iced_native"
-version = "0.8.0"
+version = "0.9.1"
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
edition = "2021"
description = "A renderer-agnostic library for native GUIs"
@@ -16,14 +16,14 @@ unicode-segmentation = "1.6"
num-traits = "0.2"
[dependencies.iced_core]
-version = "0.7"
+version = "0.8"
path = "../core"
[dependencies.iced_futures]
-version = "0.5"
+version = "0.6"
path = "../futures"
features = ["thread-pool"]
[dependencies.iced_style]
-version = "0.6.0"
+version = "0.7"
path = "../style"
diff --git a/native/README.md b/native/README.md
index 9e1f65fb..996daa76 100644
--- a/native/README.md
+++ b/native/README.md
@@ -28,7 +28,7 @@ To achieve this, it introduces a bunch of reusable interfaces:
Add `iced_native` as a dependency in your `Cargo.toml`:
```toml
-iced_native = "0.8"
+iced_native = "0.9"
```
__Iced moves fast and the `master` branch can contain breaking changes!__ If
diff --git a/native/src/image.rs b/native/src/image.rs
index 4c5e926b..70fbade0 100644
--- a/native/src/image.rs
+++ b/native/src/image.rs
@@ -28,7 +28,7 @@ impl Handle {
pub fn from_pixels(
width: u32,
height: u32,
- pixels: impl AsRef<[u8]> + Clone + Send + Sync + 'static,
+ pixels: impl AsRef<[u8]> + Send + Sync + 'static,
) -> Handle {
Self::from_data(Data::Rgba {
width,
@@ -44,7 +44,7 @@ impl Handle {
/// This is useful if you already have your image loaded in-memory, maybe
/// because you downloaded or generated it procedurally.
pub fn from_memory(
- bytes: impl AsRef<[u8]> + Clone + Send + Sync + 'static,
+ bytes: impl AsRef<[u8]> + Send + Sync + 'static,
) -> Handle {
Self::from_data(Data::Bytes(Bytes::new(bytes)))
}
@@ -93,7 +93,7 @@ pub struct Bytes(Arc<dyn AsRef<[u8]> + Send + Sync + 'static>);
impl Bytes {
/// Creates new [`Bytes`] around `data`.
- pub fn new(data: impl AsRef<[u8]> + Clone + Send + Sync + 'static) -> Self {
+ pub fn new(data: impl AsRef<[u8]> + Send + Sync + 'static) -> Self {
Self(Arc::new(data))
}
}
diff --git a/native/src/lib.rs b/native/src/lib.rs
index 7c406ae5..ebdc8490 100644
--- a/native/src/lib.rs
+++ b/native/src/lib.rs
@@ -23,8 +23,8 @@
//! - Build a new renderer, see the [renderer] module.
//! - Build a custom widget, start at the [`Widget`] trait.
//!
-//! [`iced_core`]: https://github.com/iced-rs/iced/tree/0.7/core
-//! [`iced_winit`]: https://github.com/iced-rs/iced/tree/0.7/winit
+//! [`iced_core`]: https://github.com/iced-rs/iced/tree/0.8/core
+//! [`iced_winit`]: https://github.com/iced-rs/iced/tree/0.8/winit
//! [`druid`]: https://github.com/xi-editor/druid
//! [`raw-window-handle`]: https://github.com/rust-windowing/raw-window-handle
//! [renderer]: crate::renderer
diff --git a/native/src/overlay/menu.rs b/native/src/overlay/menu.rs
index efee14d4..50f741ef 100644
--- a/native/src/overlay/menu.rs
+++ b/native/src/overlay/menu.rs
@@ -344,7 +344,8 @@ where
let size = {
let intrinsic = Size::new(
0.0,
- text_size + self.padding.vertical() * self.options.len() as f32,
+ (text_size + self.padding.vertical())
+ * self.options.len() as f32,
);
limits.resolve(intrinsic)
diff --git a/native/src/subscription.rs b/native/src/subscription.rs
index f517fc70..859abe8e 100644
--- a/native/src/subscription.rs
+++ b/native/src/subscription.rs
@@ -184,7 +184,7 @@ where
/// Check out the [`websocket`] example, which showcases this pattern to maintain a WebSocket
/// connection open.
///
-/// [`websocket`]: https://github.com/iced-rs/iced/tree/0.7/examples/websocket
+/// [`websocket`]: https://github.com/iced-rs/iced/tree/0.8/examples/websocket
pub fn unfold<I, T, Fut, Message>(
id: I,
initial: T,
diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs
index 2358bff1..68ccda55 100644
--- a/native/src/user_interface.rs
+++ b/native/src/user_interface.rs
@@ -21,8 +21,8 @@ use crate::{
/// The [`integration_opengl`] & [`integration_wgpu`] examples use a
/// [`UserInterface`] to integrate Iced in an existing graphical application.
///
-/// [`integration_opengl`]: https://github.com/iced-rs/iced/tree/0.7/examples/integration_opengl
-/// [`integration_wgpu`]: https://github.com/iced-rs/iced/tree/0.7/examples/integration_wgpu
+/// [`integration_opengl`]: https://github.com/iced-rs/iced/tree/0.8/examples/integration_opengl
+/// [`integration_wgpu`]: https://github.com/iced-rs/iced/tree/0.8/examples/integration_wgpu
#[allow(missing_debug_implementations)]
pub struct UserInterface<'a, Message, Renderer> {
root: Element<'a, Message, Renderer>,
@@ -440,12 +440,13 @@ where
overlay.layout(renderer, self.bounds, Vector::ZERO)
});
- let new_cursor_position =
- if overlay_layout.bounds().contains(cursor_position) {
- Point::new(-1.0, -1.0)
- } else {
- cursor_position
- };
+ let new_cursor_position = if overlay
+ .is_over(Layout::new(&overlay_layout), cursor_position)
+ {
+ Point::new(-1.0, -1.0)
+ } else {
+ cursor_position
+ };
self.overlay = Some(overlay_layout);
diff --git a/native/src/widget.rs b/native/src/widget.rs
index fb759ec8..2b3ca7be 100644
--- a/native/src/widget.rs
+++ b/native/src/widget.rs
@@ -110,12 +110,12 @@ use crate::{Clipboard, Layout, Length, Point, Rectangle, Shell};
/// - [`geometry`], a custom widget showcasing how to draw geometry with the
/// `Mesh2D` primitive in [`iced_wgpu`].
///
-/// [examples]: https://github.com/iced-rs/iced/tree/0.7/examples
-/// [`bezier_tool`]: https://github.com/iced-rs/iced/tree/0.7/examples/bezier_tool
-/// [`custom_widget`]: https://github.com/iced-rs/iced/tree/0.7/examples/custom_widget
-/// [`geometry`]: https://github.com/iced-rs/iced/tree/0.7/examples/geometry
+/// [examples]: https://github.com/iced-rs/iced/tree/0.8/examples
+/// [`bezier_tool`]: https://github.com/iced-rs/iced/tree/0.8/examples/bezier_tool
+/// [`custom_widget`]: https://github.com/iced-rs/iced/tree/0.8/examples/custom_widget
+/// [`geometry`]: https://github.com/iced-rs/iced/tree/0.8/examples/geometry
/// [`lyon`]: https://github.com/nical/lyon
-/// [`iced_wgpu`]: https://github.com/iced-rs/iced/tree/0.7/wgpu
+/// [`iced_wgpu`]: https://github.com/iced-rs/iced/tree/0.8/wgpu
pub trait Widget<Message, Renderer>
where
Renderer: crate::Renderer,
diff --git a/native/src/widget/pane_grid.rs b/native/src/widget/pane_grid.rs
index 83564c3f..bcb17ebd 100644
--- a/native/src/widget/pane_grid.rs
+++ b/native/src/widget/pane_grid.rs
@@ -6,7 +6,7 @@
//! The [`pane_grid` example] showcases how to use a [`PaneGrid`] with resizing,
//! drag and drop, and hotkey support.
//!
-//! [`pane_grid` example]: https://github.com/iced-rs/iced/tree/0.7/examples/pane_grid
+//! [`pane_grid` example]: https://github.com/iced-rs/iced/tree/0.8/examples/pane_grid
mod axis;
mod configuration;
mod content;
diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs
index d10797bb..d3715b1c 100644
--- a/native/src/widget/slider.rs
+++ b/native/src/widget/slider.rs
@@ -421,8 +421,8 @@ pub fn draw<T, R>(
let handle_offset = if range_start >= range_end {
0.0
} else {
- bounds.width * (value - range_start) / (range_end - range_start)
- - handle_width / 2.0
+ (bounds.width - handle_width) * (value - range_start)
+ / (range_end - range_start)
};
renderer.fill_quad(
diff --git a/native/src/widget/vertical_slider.rs b/native/src/widget/vertical_slider.rs
index 0e2f5fc9..f1687e38 100644
--- a/native/src/widget/vertical_slider.rs
+++ b/native/src/widget/vertical_slider.rs
@@ -416,8 +416,8 @@ pub fn draw<T, R>(
let handle_offset = if range_start >= range_end {
0.0
} else {
- bounds.height * (value - range_end) / (range_start - range_end)
- - handle_width / 2.0
+ (bounds.height - handle_width) * (value - range_end)
+ / (range_start - range_end)
};
renderer.fill_quad(