From aac7ad3e14aaa9faf7d52fe9b91bc64cb037d576 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 9 Mar 2020 22:35:25 +0100 Subject: Update `winit` to `0.22` --- examples/integration/src/main.rs | 12 +++++------- winit/Cargo.toml | 2 +- winit/src/application.rs | 9 +++------ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 4be913c1..2cb89ffc 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -10,7 +10,7 @@ use iced_wgpu::{ use iced_winit::{winit, Cache, Clipboard, MouseCursor, Size, UserInterface}; use winit::{ - event::{DeviceEvent, Event, ModifiersState, WindowEvent}, + event::{Event, ModifiersState, WindowEvent}, event_loop::{ControlFlow, EventLoop}, }; @@ -66,14 +66,11 @@ pub fn main() { *control_flow = ControlFlow::Wait; match event { - Event::DeviceEvent { - event: DeviceEvent::ModifiersChanged(new_modifiers), - .. - } => { - modifiers = new_modifiers; - } Event::WindowEvent { event, .. } => { match event { + WindowEvent::ModifiersChanged(new_modifiers) => { + modifiers = new_modifiers; + } WindowEvent::Resized(new_size) => { logical_size = new_size.to_logical(window.scale_factor()); @@ -82,6 +79,7 @@ pub fn main() { WindowEvent::CloseRequested => { *control_flow = ControlFlow::Exit; } + _ => {} } diff --git a/winit/Cargo.toml b/winit/Cargo.toml index 63df1d63..a70ecb9d 100644 --- a/winit/Cargo.toml +++ b/winit/Cargo.toml @@ -14,7 +14,7 @@ categories = ["gui"] debug = [] [dependencies] -winit = "0.21" +winit = "0.22" log = "0.4" [dependencies.iced_native] diff --git a/winit/src/application.rs b/winit/src/application.rs index f5aa799c..891b8f12 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -347,6 +347,9 @@ pub trait Application: Sized { WindowEvent::CloseRequested => { *control_flow = ControlFlow::Exit; } + WindowEvent::ModifiersChanged(new_modifiers) => { + modifiers = new_modifiers; + } #[cfg(target_os = "macos")] WindowEvent::KeyboardInput { input: @@ -382,12 +385,6 @@ pub trait Application: Sized { events.push(event); } } - event::Event::DeviceEvent { - event: event::DeviceEvent::ModifiersChanged(new_modifiers), - .. - } => { - modifiers = new_modifiers; - } _ => { *control_flow = ControlFlow::Wait; } -- cgit From f1168187c917f84130e97be81e2ccd4181fe9539 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 12 Mar 2020 07:32:04 +0100 Subject: Update `window_clipboard` in `iced_winit` --- winit/Cargo.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/winit/Cargo.toml b/winit/Cargo.toml index a70ecb9d..ca2018c7 100644 --- a/winit/Cargo.toml +++ b/winit/Cargo.toml @@ -15,15 +15,12 @@ debug = [] [dependencies] winit = "0.22" +window_clipboard = "0.1" log = "0.4" [dependencies.iced_native] version = "0.1.0-alpha" path = "../native" -[dependencies.window_clipboard] -git = "https://github.com/hecrj/window_clipboard" -rev = "22c6dd6c04cd05d528029b50a30c56417cd4bebf" - [target.'cfg(target_os = "windows")'.dependencies.winapi] version = "0.3.6" -- cgit From e1438774af809c2951c4c7446638500446c81111 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 14 Mar 2020 23:25:19 +0100 Subject: Fix `Scrollable` width consistency --- examples/styling/src/main.rs | 1 + native/src/widget/scrollable.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs index 47408624..d6f41b04 100644 --- a/examples/styling/src/main.rs +++ b/examples/styling/src/main.rs @@ -93,6 +93,7 @@ impl Sandbox for Styling { ProgressBar::new(0.0..=100.0, self.slider_value).style(self.theme); let scrollable = Scrollable::new(&mut self.scroll) + .width(Length::Fill) .height(Length::Units(100)) .style(self.theme) .push(Text::new("Scroll me!")) diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index e83f25af..ec9746d4 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -118,7 +118,7 @@ where Renderer: 'static + self::Renderer + column::Renderer, { fn width(&self) -> Length { - Length::Fill + Widget::::width(&self.content) } fn height(&self) -> Length { @@ -132,7 +132,7 @@ where ) -> layout::Node { let limits = limits .max_height(self.max_height) - .width(Length::Fill) + .width(Widget::::width(&self.content)) .height(self.height); let child_limits = layout::Limits::new( -- cgit From ae123d8f14c14a2c393bcf00dc364844a32cc0c8 Mon Sep 17 00:00:00 2001 From: Rowun Giles <1868220+rowungiles@users.noreply.github.com> Date: Mon, 16 Mar 2020 10:08:37 +0000 Subject: Instantiate Column and Row with children --- native/src/widget/column.rs | 16 ++++++++++++++++ native/src/widget/row.rs | 16 ++++++++++++++++ web/src/widget/column.rs | 16 ++++++++++++++++ web/src/widget/row.rs | 16 ++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/native/src/widget/column.rs b/native/src/widget/column.rs index 104790d4..e6c795e5 100644 --- a/native/src/widget/column.rs +++ b/native/src/widget/column.rs @@ -42,6 +42,22 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> { } } + /// Creates a [`Column`] with children. + /// + /// [`Column`]: struct.Column.html + pub fn new_with_children(children: Vec>) -> Self { + Column { + spacing: 0, + padding: 0, + width: Length::Shrink, + height: Length::Shrink, + max_width: u32::MAX, + max_height: u32::MAX, + align_items: Align::Start, + children, + } + } + /// Sets the vertical spacing _between_ elements. /// /// Custom margins per element do not exist in Iced. You should use this diff --git a/native/src/widget/row.rs b/native/src/widget/row.rs index 775b953e..3d803fa2 100644 --- a/native/src/widget/row.rs +++ b/native/src/widget/row.rs @@ -42,6 +42,22 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> { } } + /// Creates a [`Row`] with children. + /// + /// [`Row`]: struct.Row.html + pub fn new_with_children(children: Vec>) -> Self { + Row { + spacing: 0, + padding: 0, + width: Length::Shrink, + height: Length::Shrink, + max_width: u32::MAX, + max_height: u32::MAX, + align_items: Align::Start, + children, + } + } + /// Sets the horizontal spacing _between_ elements. /// /// Custom margins per element do not exist in Iced. You should use this diff --git a/web/src/widget/column.rs b/web/src/widget/column.rs index 6454ffba..f1d9f9a2 100644 --- a/web/src/widget/column.rs +++ b/web/src/widget/column.rs @@ -37,6 +37,22 @@ impl<'a, Message> Column<'a, Message> { } } + /// Creates a [`Column`] with children. + /// + /// [`Column`]: struct.Column.html + pub fn new_with_children(children: Vec>) -> Self { + Column { + spacing: 0, + padding: 0, + width: Length::Fill, + height: Length::Shrink, + max_width: u32::MAX, + max_height: u32::MAX, + align_items: Align::Start, + children, + } + } + /// Sets the vertical spacing _between_ elements. /// /// Custom margins per element do not exist in Iced. You should use this diff --git a/web/src/widget/row.rs b/web/src/widget/row.rs index 02035113..55077d52 100644 --- a/web/src/widget/row.rs +++ b/web/src/widget/row.rs @@ -37,6 +37,22 @@ impl<'a, Message> Row<'a, Message> { } } + /// Creates a [`Row`] with children. + /// + /// [`Row`]: struct.Row.html + pub fn new_with_children(children: Vec>) -> Self { + Row { + spacing: 0, + padding: 0, + width: Length::Fill, + height: Length::Shrink, + max_width: u32::MAX, + max_height: u32::MAX, + align_items: Align::Start, + children, + } + } + /// Sets the horizontal spacing _between_ elements. /// /// Custom margins per element do not exist in Iced. You should use this -- cgit From a146e53eb0f9bf2714f7f2a4227fe445f4905ff1 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 17 Mar 2020 00:50:23 +0100 Subject: Rename `new_with_children` to `with_children` --- native/src/widget/column.rs | 6 ++++-- native/src/widget/row.rs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/native/src/widget/column.rs b/native/src/widget/column.rs index e6c795e5..b38b1ef1 100644 --- a/native/src/widget/column.rs +++ b/native/src/widget/column.rs @@ -42,10 +42,12 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> { } } - /// Creates a [`Column`] with children. + /// Creates a [`Column`] with the given elements. /// /// [`Column`]: struct.Column.html - pub fn new_with_children(children: Vec>) -> Self { + pub fn with_children( + children: Vec>, + ) -> Self { Column { spacing: 0, padding: 0, diff --git a/native/src/widget/row.rs b/native/src/widget/row.rs index 3d803fa2..b71d6480 100644 --- a/native/src/widget/row.rs +++ b/native/src/widget/row.rs @@ -42,10 +42,12 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> { } } - /// Creates a [`Row`] with children. + /// Creates a [`Row`] with the given elements. /// /// [`Row`]: struct.Row.html - pub fn new_with_children(children: Vec>) -> Self { + pub fn with_children( + children: Vec>, + ) -> Self { Row { spacing: 0, padding: 0, -- cgit From 95c8031f3d2800ade28b593c17c138c6d389b1ae Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 17 Mar 2020 00:51:01 +0100 Subject: Reuse `with_children` to remove some duplication --- native/src/widget/column.rs | 11 +---------- native/src/widget/row.rs | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/native/src/widget/column.rs b/native/src/widget/column.rs index b38b1ef1..a7a6f242 100644 --- a/native/src/widget/column.rs +++ b/native/src/widget/column.rs @@ -30,16 +30,7 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> { /// /// [`Column`]: struct.Column.html pub fn new() -> Self { - Column { - spacing: 0, - padding: 0, - width: Length::Shrink, - height: Length::Shrink, - max_width: u32::MAX, - max_height: u32::MAX, - align_items: Align::Start, - children: Vec::new(), - } + Self::with_children(Vec::new()) } /// Creates a [`Column`] with the given elements. diff --git a/native/src/widget/row.rs b/native/src/widget/row.rs index b71d6480..c8812ea2 100644 --- a/native/src/widget/row.rs +++ b/native/src/widget/row.rs @@ -30,16 +30,7 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> { /// /// [`Row`]: struct.Row.html pub fn new() -> Self { - Row { - spacing: 0, - padding: 0, - width: Length::Shrink, - height: Length::Shrink, - max_width: u32::MAX, - max_height: u32::MAX, - align_items: Align::Start, - children: Vec::new(), - } + Self::with_children(Vec::new()) } /// Creates a [`Row`] with the given elements. -- cgit From 99b5212550f225a21e1d1144c6fb9ebb8f4e6ed2 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 17 Mar 2020 00:53:51 +0100 Subject: Implement `Column` and `Row` changes in `iced_web` --- web/src/widget/column.rs | 15 +++------------ web/src/widget/row.rs | 15 +++------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/web/src/widget/column.rs b/web/src/widget/column.rs index f1d9f9a2..25b88b0e 100644 --- a/web/src/widget/column.rs +++ b/web/src/widget/column.rs @@ -25,22 +25,13 @@ impl<'a, Message> Column<'a, Message> { /// /// [`Column`]: struct.Column.html pub fn new() -> Self { - Column { - spacing: 0, - padding: 0, - width: Length::Fill, - height: Length::Shrink, - max_width: u32::MAX, - max_height: u32::MAX, - align_items: Align::Start, - children: Vec::new(), - } + Self::with_children(Vec::new()) } - /// Creates a [`Column`] with children. + /// Creates a [`Column`] with the given elements. /// /// [`Column`]: struct.Column.html - pub fn new_with_children(children: Vec>) -> Self { + pub fn with_children(children: Vec>) -> Self { Column { spacing: 0, padding: 0, diff --git a/web/src/widget/row.rs b/web/src/widget/row.rs index 55077d52..cfa10fdf 100644 --- a/web/src/widget/row.rs +++ b/web/src/widget/row.rs @@ -25,22 +25,13 @@ impl<'a, Message> Row<'a, Message> { /// /// [`Row`]: struct.Row.html pub fn new() -> Self { - Row { - spacing: 0, - padding: 0, - width: Length::Fill, - height: Length::Shrink, - max_width: u32::MAX, - max_height: u32::MAX, - align_items: Align::Start, - children: Vec::new(), - } + Self::with_children(Vec::new()) } - /// Creates a [`Row`] with children. + /// Creates a [`Row`] with the given elements. /// /// [`Row`]: struct.Row.html - pub fn new_with_children(children: Vec>) -> Self { + pub fn with_children(children: Vec>) -> Self { Row { spacing: 0, padding: 0, -- cgit