From 4aed0fa4b6d63b739b5557ef16f6077988cd2758 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector0193@gmail.com>
Date: Tue, 19 May 2020 20:01:55 +0200
Subject: Rename `window::Backend` to `Compositor`

---
 src/application.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/application.rs b/src/application.rs
index 689332f1..0ae2ec55 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -216,7 +216,7 @@ impl<A> iced_winit::Application for Instance<A>
 where
     A: Application,
 {
-    type Backend = iced_wgpu::window::Backend;
+    type Compositor = iced_wgpu::window::Compositor;
     type Executor = A::Executor;
     type Flags = A::Flags;
     type Message = A::Message;
-- 
cgit 


From e0e4ee73feead3f05730625c7e1917b63f0b384e Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector0193@gmail.com>
Date: Thu, 21 May 2020 00:37:47 +0200
Subject: Implement `iced_glutin` :tada:

---
 src/application.rs | 20 ++++++++++----------
 src/element.rs     |  2 +-
 src/lib.rs         |  2 +-
 src/settings.rs    |  8 ++++----
 src/widget.rs      | 24 +++++-------------------
 5 files changed, 21 insertions(+), 35 deletions(-)

(limited to 'src')

diff --git a/src/application.rs b/src/application.rs
index 0ae2ec55..644a4824 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -188,19 +188,19 @@ pub trait Application: Sized {
     {
         #[cfg(not(target_arch = "wasm32"))]
         {
-            let wgpu_settings = iced_wgpu::Settings {
+            let glow_settings = iced_glow::Settings {
                 default_font: settings.default_font,
                 antialiasing: if settings.antialiasing {
-                    Some(iced_wgpu::settings::Antialiasing::MSAAx4)
+                    Some(iced_glow::settings::Antialiasing::MSAAx4)
                 } else {
                     None
                 },
-                ..iced_wgpu::Settings::default()
+                ..iced_glow::Settings::default()
             };
 
-            <Instance<Self> as iced_winit::Application>::run(
+            <Instance<Self> as iced_glutin::Application>::run(
                 settings.into(),
-                wgpu_settings,
+                glow_settings,
             );
         }
 
@@ -212,11 +212,11 @@ pub trait Application: Sized {
 struct Instance<A: Application>(A);
 
 #[cfg(not(target_arch = "wasm32"))]
-impl<A> iced_winit::Application for Instance<A>
+impl<A> iced_glutin::Application for Instance<A>
 where
     A: Application,
 {
-    type Compositor = iced_wgpu::window::Compositor;
+    type Compositor = iced_glow::window::Compositor;
     type Executor = A::Executor;
     type Flags = A::Flags;
     type Message = A::Message;
@@ -231,10 +231,10 @@ where
         self.0.title()
     }
 
-    fn mode(&self) -> iced_winit::Mode {
+    fn mode(&self) -> iced_glutin::Mode {
         match self.0.mode() {
-            window::Mode::Windowed => iced_winit::Mode::Windowed,
-            window::Mode::Fullscreen => iced_winit::Mode::Fullscreen,
+            window::Mode::Windowed => iced_glutin::Mode::Windowed,
+            window::Mode::Fullscreen => iced_glutin::Mode::Fullscreen,
         }
     }
 
diff --git a/src/element.rs b/src/element.rs
index e5356fb6..e7504615 100644
--- a/src/element.rs
+++ b/src/element.rs
@@ -3,7 +3,7 @@
 /// This is an alias of an `iced_native` element with a default `Renderer`.
 #[cfg(not(target_arch = "wasm32"))]
 pub type Element<'a, Message> =
-    iced_winit::Element<'a, Message, iced_wgpu::Renderer>;
+    iced_glutin::Element<'a, Message, iced_glow::Renderer>;
 
 #[cfg(target_arch = "wasm32")]
 pub use iced_web::Element;
diff --git a/src/lib.rs b/src/lib.rs
index 2c08268b..58cc141d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -207,7 +207,7 @@ pub use sandbox::Sandbox;
 pub use settings::Settings;
 
 #[cfg(not(target_arch = "wasm32"))]
-use iced_winit as runtime;
+use iced_glutin as runtime;
 
 #[cfg(target_arch = "wasm32")]
 use iced_web as runtime;
diff --git a/src/settings.rs b/src/settings.rs
index 01ad0ee0..36685763 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -51,10 +51,10 @@ impl<Flags> Settings<Flags> {
 }
 
 #[cfg(not(target_arch = "wasm32"))]
-impl<Flags> From<Settings<Flags>> for iced_winit::Settings<Flags> {
-    fn from(settings: Settings<Flags>) -> iced_winit::Settings<Flags> {
-        iced_winit::Settings {
-            window: iced_winit::settings::Window {
+impl<Flags> From<Settings<Flags>> for iced_glutin::Settings<Flags> {
+    fn from(settings: Settings<Flags>) -> iced_glutin::Settings<Flags> {
+        iced_glutin::Settings {
+            window: iced_glutin::settings::Window {
                 size: settings.window.size,
                 resizable: settings.window.resizable,
                 decorations: settings.window.decorations,
diff --git a/src/widget.rs b/src/widget.rs
index e33a6b2c..eebf5f2a 100644
--- a/src/widget.rs
+++ b/src/widget.rs
@@ -18,29 +18,27 @@
 //! [`text_input::State`]: text_input/struct.State.html
 #[cfg(not(target_arch = "wasm32"))]
 mod platform {
-    pub use iced_wgpu::widget::{
+    pub use iced_glow::widget::{
         button, checkbox, container, pane_grid, progress_bar, radio,
-        scrollable, slider, text_input, Text,
+        scrollable, slider, text_input, Column, Row, Space, Text,
     };
 
     #[cfg(feature = "canvas")]
     #[cfg_attr(docsrs, doc(cfg(feature = "canvas")))]
-    pub use iced_wgpu::widget::canvas;
+    pub use iced_glow::widget::canvas;
 
     #[cfg_attr(docsrs, doc(cfg(feature = "image")))]
     pub mod image {
         //! Display images in your user interface.
-        pub use iced_winit::image::{Handle, Image};
+        pub use iced_glutin::image::{Handle, Image};
     }
 
     #[cfg_attr(docsrs, doc(cfg(feature = "svg")))]
     pub mod svg {
         //! Display vector graphics in your user interface.
-        pub use iced_winit::svg::{Handle, Svg};
+        pub use iced_glutin::svg::{Handle, Svg};
     }
 
-    pub use iced_winit::Space;
-
     #[doc(no_inline)]
     pub use {
         button::Button, checkbox::Checkbox, container::Container, image::Image,
@@ -52,18 +50,6 @@ mod platform {
     #[cfg(feature = "canvas")]
     #[doc(no_inline)]
     pub use canvas::Canvas;
-
-    /// A container that distributes its contents vertically.
-    ///
-    /// This is an alias of an `iced_native` column with a default `Renderer`.
-    pub type Column<'a, Message> =
-        iced_winit::Column<'a, Message, iced_wgpu::Renderer>;
-
-    /// A container that distributes its contents horizontally.
-    ///
-    /// This is an alias of an `iced_native` row with a default `Renderer`.
-    pub type Row<'a, Message> =
-        iced_winit::Row<'a, Message, iced_wgpu::Renderer>;
 }
 
 #[cfg(target_arch = "wasm32")]
-- 
cgit 


From ae5e2c6c734894d71b2034a498a858b7997c5d3d Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector0193@gmail.com>
Date: Thu, 21 May 2020 04:27:31 +0200
Subject: Introduce `Program` and `State`

---
 src/application.rs | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

(limited to 'src')

diff --git a/src/application.rs b/src/application.rs
index 644a4824..b6f2227e 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -198,10 +198,11 @@ pub trait Application: Sized {
                 ..iced_glow::Settings::default()
             };
 
-            <Instance<Self> as iced_glutin::Application>::run(
-                settings.into(),
-                glow_settings,
-            );
+            iced_glutin::application::run::<
+                Instance<Self>,
+                Self::Executor,
+                iced_glow::window::Compositor,
+            >(settings.into(), glow_settings);
         }
 
         #[cfg(target_arch = "wasm32")]
@@ -211,15 +212,29 @@ pub trait Application: Sized {
 
 struct Instance<A: Application>(A);
 
+#[cfg(not(target_arch = "wasm32"))]
+impl<A> iced_glutin::Program for Instance<A>
+where
+    A: Application,
+{
+    type Renderer = iced_glow::Renderer;
+    type Message = A::Message;
+
+    fn update(&mut self, message: Self::Message) -> Command<Self::Message> {
+        self.0.update(message)
+    }
+
+    fn view(&mut self) -> Element<'_, Self::Message> {
+        self.0.view()
+    }
+}
+
 #[cfg(not(target_arch = "wasm32"))]
 impl<A> iced_glutin::Application for Instance<A>
 where
     A: Application,
 {
-    type Compositor = iced_glow::window::Compositor;
-    type Executor = A::Executor;
     type Flags = A::Flags;
-    type Message = A::Message;
 
     fn new(flags: Self::Flags) -> (Self, Command<A::Message>) {
         let (app, command) = A::new(flags);
@@ -238,17 +253,9 @@ where
         }
     }
 
-    fn update(&mut self, message: Self::Message) -> Command<Self::Message> {
-        self.0.update(message)
-    }
-
     fn subscription(&self) -> Subscription<Self::Message> {
         self.0.subscription()
     }
-
-    fn view(&mut self) -> Element<'_, Self::Message> {
-        self.0.view()
-    }
 }
 
 #[cfg(target_arch = "wasm32")]
-- 
cgit 


From 22ced3485eb6f295faaab1e31d8d1b8d61fc422b Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector0193@gmail.com>
Date: Wed, 27 May 2020 05:05:13 +0200
Subject: Introduce feature flags to enable `iced_glow`

Also keep `iced_wgpu` as the default renderer for the time being.
---
 src/application.rs | 24 ++++++++++++------------
 src/element.rs     |  2 +-
 src/lib.rs         | 29 +++++++++++++++++++++++------
 src/settings.rs    |  8 ++++----
 src/widget.rs      | 15 +++++++++------
 5 files changed, 49 insertions(+), 29 deletions(-)

(limited to 'src')

diff --git a/src/application.rs b/src/application.rs
index b6f2227e..19cab7da 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -188,21 +188,21 @@ pub trait Application: Sized {
     {
         #[cfg(not(target_arch = "wasm32"))]
         {
-            let glow_settings = iced_glow::Settings {
+            let renderer_settings = crate::renderer::Settings {
                 default_font: settings.default_font,
                 antialiasing: if settings.antialiasing {
-                    Some(iced_glow::settings::Antialiasing::MSAAx4)
+                    Some(crate::renderer::settings::Antialiasing::MSAAx4)
                 } else {
                     None
                 },
-                ..iced_glow::Settings::default()
+                ..crate::renderer::Settings::default()
             };
 
-            iced_glutin::application::run::<
+            crate::runtime::application::run::<
                 Instance<Self>,
                 Self::Executor,
-                iced_glow::window::Compositor,
-            >(settings.into(), glow_settings);
+                crate::renderer::window::Compositor,
+            >(settings.into(), renderer_settings);
         }
 
         #[cfg(target_arch = "wasm32")]
@@ -213,11 +213,11 @@ pub trait Application: Sized {
 struct Instance<A: Application>(A);
 
 #[cfg(not(target_arch = "wasm32"))]
-impl<A> iced_glutin::Program for Instance<A>
+impl<A> iced_winit::Program for Instance<A>
 where
     A: Application,
 {
-    type Renderer = iced_glow::Renderer;
+    type Renderer = crate::renderer::Renderer;
     type Message = A::Message;
 
     fn update(&mut self, message: Self::Message) -> Command<Self::Message> {
@@ -230,7 +230,7 @@ where
 }
 
 #[cfg(not(target_arch = "wasm32"))]
-impl<A> iced_glutin::Application for Instance<A>
+impl<A> crate::runtime::Application for Instance<A>
 where
     A: Application,
 {
@@ -246,10 +246,10 @@ where
         self.0.title()
     }
 
-    fn mode(&self) -> iced_glutin::Mode {
+    fn mode(&self) -> iced_winit::Mode {
         match self.0.mode() {
-            window::Mode::Windowed => iced_glutin::Mode::Windowed,
-            window::Mode::Fullscreen => iced_glutin::Mode::Fullscreen,
+            window::Mode::Windowed => iced_winit::Mode::Windowed,
+            window::Mode::Fullscreen => iced_winit::Mode::Fullscreen,
         }
     }
 
diff --git a/src/element.rs b/src/element.rs
index e7504615..6f47c701 100644
--- a/src/element.rs
+++ b/src/element.rs
@@ -3,7 +3,7 @@
 /// This is an alias of an `iced_native` element with a default `Renderer`.
 #[cfg(not(target_arch = "wasm32"))]
 pub type Element<'a, Message> =
-    iced_glutin::Element<'a, Message, iced_glow::Renderer>;
+    crate::runtime::Element<'a, Message, crate::renderer::Renderer>;
 
 #[cfg(target_arch = "wasm32")]
 pub use iced_web::Element;
diff --git a/src/lib.rs b/src/lib.rs
index 58cc141d..d08b39cf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -197,6 +197,29 @@ pub mod window;
 #[cfg_attr(docsrs, doc(cfg(any(feature = "tokio", feature = "async-std"))))]
 pub mod time;
 
+#[cfg(all(
+    not(target_arch = "wasm32"),
+    not(feature = "glow"),
+    feature = "wgpu"
+))]
+use iced_winit as runtime;
+
+#[cfg(all(not(target_arch = "wasm32"), feature = "glow"))]
+use iced_glutin as runtime;
+
+#[cfg(all(
+    not(target_arch = "wasm32"),
+    not(feature = "glow"),
+    feature = "wgpu"
+))]
+use iced_wgpu as renderer;
+
+#[cfg(all(not(target_arch = "wasm32"), feature = "glow"))]
+use iced_glow as renderer;
+
+#[cfg(target_arch = "wasm32")]
+use iced_web as runtime;
+
 #[doc(no_inline)]
 pub use widget::*;
 
@@ -206,12 +229,6 @@ pub use executor::Executor;
 pub use sandbox::Sandbox;
 pub use settings::Settings;
 
-#[cfg(not(target_arch = "wasm32"))]
-use iced_glutin as runtime;
-
-#[cfg(target_arch = "wasm32")]
-use iced_web as runtime;
-
 pub use runtime::{
     futures, Align, Background, Color, Command, Font, HorizontalAlignment,
     Length, Point, Rectangle, Size, Subscription, Vector, VerticalAlignment,
diff --git a/src/settings.rs b/src/settings.rs
index 36685763..01ad0ee0 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -51,10 +51,10 @@ impl<Flags> Settings<Flags> {
 }
 
 #[cfg(not(target_arch = "wasm32"))]
-impl<Flags> From<Settings<Flags>> for iced_glutin::Settings<Flags> {
-    fn from(settings: Settings<Flags>) -> iced_glutin::Settings<Flags> {
-        iced_glutin::Settings {
-            window: iced_glutin::settings::Window {
+impl<Flags> From<Settings<Flags>> for iced_winit::Settings<Flags> {
+    fn from(settings: Settings<Flags>) -> iced_winit::Settings<Flags> {
+        iced_winit::Settings {
+            window: iced_winit::settings::Window {
                 size: settings.window.size,
                 resizable: settings.window.resizable,
                 decorations: settings.window.decorations,
diff --git a/src/widget.rs b/src/widget.rs
index eebf5f2a..3e4d4788 100644
--- a/src/widget.rs
+++ b/src/widget.rs
@@ -18,25 +18,28 @@
 //! [`text_input::State`]: text_input/struct.State.html
 #[cfg(not(target_arch = "wasm32"))]
 mod platform {
-    pub use iced_glow::widget::{
+    pub use crate::renderer::widget::{
         button, checkbox, container, pane_grid, progress_bar, radio,
         scrollable, slider, text_input, Column, Row, Space, Text,
     };
 
-    #[cfg(feature = "canvas")]
-    #[cfg_attr(docsrs, doc(cfg(feature = "canvas")))]
-    pub use iced_glow::widget::canvas;
+    #[cfg(any(feature = "canvas", feature = "glow_canvas"))]
+    #[cfg_attr(
+        docsrs,
+        doc(cfg(any(feature = "canvas", feature = "glow_canvas")))
+    )]
+    pub use crate::renderer::widget::canvas;
 
     #[cfg_attr(docsrs, doc(cfg(feature = "image")))]
     pub mod image {
         //! Display images in your user interface.
-        pub use iced_glutin::image::{Handle, Image};
+        pub use crate::runtime::image::{Handle, Image};
     }
 
     #[cfg_attr(docsrs, doc(cfg(feature = "svg")))]
     pub mod svg {
         //! Display vector graphics in your user interface.
-        pub use iced_glutin::svg::{Handle, Svg};
+        pub use crate::runtime::svg::{Handle, Svg};
     }
 
     #[doc(no_inline)]
-- 
cgit