summaryrefslogtreecommitdiffstats
path: root/glow
diff options
context:
space:
mode:
Diffstat (limited to 'glow')
-rw-r--r--glow/Cargo.toml8
-rw-r--r--glow/README.md6
-rw-r--r--glow/src/backend.rs3
-rw-r--r--glow/src/lib.rs28
-rw-r--r--glow/src/program.rs2
-rw-r--r--glow/src/quad/compatibility.rs19
-rw-r--r--glow/src/quad/core.rs2
-rw-r--r--glow/src/settings.rs14
-rw-r--r--glow/src/text.rs5
-rw-r--r--glow/src/widget.rs79
-rw-r--r--glow/src/widget/button.rs13
-rw-r--r--glow/src/widget/canvas.rs6
-rw-r--r--glow/src/widget/checkbox.rs10
-rw-r--r--glow/src/widget/container.rs11
-rw-r--r--glow/src/widget/pane_grid.rs32
-rw-r--r--glow/src/widget/pick_list.rs9
-rw-r--r--glow/src/widget/progress_bar.rs6
-rw-r--r--glow/src/widget/qr_code.rs2
-rw-r--r--glow/src/widget/radio.rs10
-rw-r--r--glow/src/widget/rule.rs3
-rw-r--r--glow/src/widget/scrollable.rs13
-rw-r--r--glow/src/widget/slider.rs5
-rw-r--r--glow/src/widget/text_input.rs13
-rw-r--r--glow/src/widget/toggler.rs10
-rw-r--r--glow/src/widget/tooltip.rs6
-rw-r--r--glow/src/window/compositor.rs32
26 files changed, 74 insertions, 273 deletions
diff --git a/glow/Cargo.toml b/glow/Cargo.toml
index e0907a66..18215e9b 100644
--- a/glow/Cargo.toml
+++ b/glow/Cargo.toml
@@ -1,11 +1,11 @@
[package]
name = "iced_glow"
-version = "0.2.0"
+version = "0.3.0"
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
edition = "2021"
description = "A glow renderer for iced"
license = "MIT AND OFL-1.1"
-repository = "https://github.com/hecrj/iced"
+repository = "https://github.com/iced-rs/iced"
[features]
canvas = ["iced_graphics/canvas"]
@@ -24,11 +24,11 @@ bytemuck = "1.4"
log = "0.4"
[dependencies.iced_native]
-version = "0.4"
+version = "0.5"
path = "../native"
[dependencies.iced_graphics]
-version = "0.2"
+version = "0.3"
path = "../graphics"
features = ["font-fallback", "font-icons", "opengl"]
diff --git a/glow/README.md b/glow/README.md
index 5e37b7a2..00f38f64 100644
--- a/glow/README.md
+++ b/glow/README.md
@@ -1,12 +1,12 @@
# `iced_glow`
[![Documentation](https://docs.rs/iced_glow/badge.svg)][documentation]
[![Crates.io](https://img.shields.io/crates/v/iced_glow.svg)](https://crates.io/crates/iced_glow)
-[![License](https://img.shields.io/crates/l/iced_glow.svg)](https://github.com/hecrj/iced/blob/master/LICENSE)
+[![License](https://img.shields.io/crates/l/iced_glow.svg)](https://github.com/iced-rs/iced/blob/master/LICENSE)
[![Discord Server](https://img.shields.io/discord/628993209984614400?label=&labelColor=6A7EC2&logo=discord&logoColor=ffffff&color=7389D8)](https://discord.gg/3xZJ65GAhd)
`iced_glow` is a [`glow`] renderer for [`iced_native`]. This renderer supports OpenGL 3.0+ and OpenGL ES 2.0.
-This is renderer is mostly used as a fallback for hardware that doesn't support [`wgpu`] (Vulkan, Metal or DX12).
+This renderer is mostly used as a fallback for hardware that doesn't support [`wgpu`] (Vulkan, Metal or DX12).
Currently, `iced_glow` supports the following primitives:
- Text, which is rendered using [`glow_glyph`]. No shaping at all.
@@ -34,7 +34,7 @@ iced_glow = "0.2"
__Iced moves fast and the `master` branch can contain breaking changes!__ If
you want to learn about a specific release, check out [the release list].
-[the release list]: https://github.com/hecrj/iced/releases
+[the release list]: https://github.com/iced-rs/iced/releases
## Current limitations
diff --git a/glow/src/backend.rs b/glow/src/backend.rs
index 89dc1aaa..78d4229e 100644
--- a/glow/src/backend.rs
+++ b/glow/src/backend.rs
@@ -13,7 +13,7 @@ use iced_native::{Font, Size};
/// A [`glow`] graphics backend for [`iced`].
///
/// [`glow`]: https://github.com/grovesNL/glow
-/// [`iced`]: https://github.com/hecrj/iced
+/// [`iced`]: https://github.com/iced-rs/iced
#[derive(Debug)]
pub struct Backend {
quad_pipeline: quad::Pipeline,
@@ -173,7 +173,6 @@ impl Backend {
glow_glyph::VerticalAlign::Bottom
}
}),
- ..Default::default()
};
self.text_pipeline.queue(text);
diff --git a/glow/src/lib.rs b/glow/src/lib.rs
index 4e5a75d7..de9c0002 100644
--- a/glow/src/lib.rs
+++ b/glow/src/lib.rs
@@ -1,16 +1,24 @@
//! A [`glow`] renderer for [`iced_native`].
//!
-//! ![The native path of the Iced ecosystem](https://github.com/hecrj/iced/blob/0525d76ff94e828b7b21634fa94a747022001c83/docs/graphs/native.png?raw=true)
+//! ![The native path of the Iced ecosystem](https://github.com/iced-rs/iced/blob/0525d76ff94e828b7b21634fa94a747022001c83/docs/graphs/native.png?raw=true)
//!
//! [`glow`]: https://github.com/grovesNL/glow
-//! [`iced_native`]: https://github.com/hecrj/iced/tree/master/native
+//! [`iced_native`]: https://github.com/iced-rs/iced/tree/0.4/native
#![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)]
-#![deny(missing_docs)]
-#![deny(missing_debug_implementations)]
-#![deny(unused_results)]
+#![deny(
+ missing_debug_implementations,
+ missing_docs,
+ unused_results,
+ clippy::extra_unused_lifetimes,
+ clippy::from_over_into,
+ clippy::needless_borrow,
+ clippy::new_without_default,
+ clippy::useless_conversion
+)]
#![forbid(rust_2018_idioms)]
+#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_cfg))]
pub use glow;
@@ -22,7 +30,6 @@ mod text;
mod triangle;
pub mod settings;
-pub mod widget;
pub mod window;
pub use backend::Backend;
@@ -30,10 +37,8 @@ pub use settings::Settings;
pub(crate) use iced_graphics::Transformation;
-#[doc(no_inline)]
-pub use widget::*;
-
pub use iced_graphics::{Error, Viewport};
+pub use iced_native::Theme;
pub use iced_native::alignment;
pub use iced_native::{Alignment, Background, Color, Command, Length, Vector};
@@ -41,5 +46,6 @@ pub use iced_native::{Alignment, Background, Color, Command, Length, Vector};
/// A [`glow`] graphics renderer for [`iced`].
///
/// [`glow`]: https://github.com/grovesNL/glow
-/// [`iced`]: https://github.com/hecrj/iced
-pub type Renderer = iced_graphics::Renderer<Backend>;
+/// [`iced`]: https://github.com/iced-rs/iced
+pub type Renderer<Theme = iced_native::Theme> =
+ iced_graphics::Renderer<Backend, Theme>;
diff --git a/glow/src/program.rs b/glow/src/program.rs
index 9a02d578..1eb9c535 100644
--- a/glow/src/program.rs
+++ b/glow/src/program.rs
@@ -70,7 +70,7 @@ impl Shader {
unsafe {
let shader = gl.create_shader(stage).expect("Cannot create shader");
- gl.shader_source(shader, &content);
+ gl.shader_source(shader, content);
gl.compile_shader(shader);
if !gl.get_shader_compile_status(shader) {
diff --git a/glow/src/quad/compatibility.rs b/glow/src/quad/compatibility.rs
index 76f98ab7..eb3fb7e0 100644
--- a/glow/src/quad/compatibility.rs
+++ b/glow/src/quad/compatibility.rs
@@ -110,22 +110,13 @@ impl Pipeline {
bounds: Rectangle<u32>,
) {
// TODO: Remove this allocation (probably by changing the shader and removing the need of two `position`)
- let vertices: Vec<Vertex> = instances
- .iter()
- .flat_map(|quad| Vertex::from_quad(quad))
- .collect();
+ let vertices: Vec<Vertex> =
+ instances.iter().flat_map(Vertex::from_quad).collect();
// TODO: Remove this allocation (or allocate only when needed)
let indices: Vec<i32> = (0..instances.len().min(MAX_QUADS) as i32)
.flat_map(|i| {
- [
- 0 + i * 4,
- 1 + i * 4,
- 2 + i * 4,
- 2 + i * 4,
- 1 + i * 4,
- 3 + i * 4,
- ]
+ [i * 4, 1 + i * 4, 2 + i * 4, 2 + i * 4, 1 + i * 4, 3 + i * 4]
})
.cycle()
.take(instances.len() * 6)
@@ -187,13 +178,13 @@ impl Pipeline {
gl.buffer_sub_data_u8_slice(
glow::ARRAY_BUFFER,
0,
- bytemuck::cast_slice(&vertices),
+ bytemuck::cast_slice(vertices),
);
gl.buffer_sub_data_u8_slice(
glow::ELEMENT_ARRAY_BUFFER,
0,
- bytemuck::cast_slice(&indices),
+ bytemuck::cast_slice(indices),
);
gl.draw_elements(
diff --git a/glow/src/quad/core.rs b/glow/src/quad/core.rs
index f37300f6..3e51b1ca 100644
--- a/glow/src/quad/core.rs
+++ b/glow/src/quad/core.rs
@@ -154,7 +154,7 @@ impl Pipeline {
gl.buffer_sub_data_u8_slice(
glow::ARRAY_BUFFER,
0,
- bytemuck::cast_slice(&instances),
+ bytemuck::cast_slice(instances),
);
gl.draw_arrays_instanced(
diff --git a/glow/src/settings.rs b/glow/src/settings.rs
index f3dddfaf..3691747b 100644
--- a/glow/src/settings.rs
+++ b/glow/src/settings.rs
@@ -4,7 +4,7 @@ pub use iced_graphics::Antialiasing;
/// The settings of a [`Backend`].
///
/// [`Backend`]: crate::Backend
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+#[derive(Clone, Copy, PartialEq, Eq)]
pub struct Settings {
/// The bytes of the font that will be used by default.
///
@@ -39,6 +39,18 @@ impl Default for Settings {
}
}
+impl std::fmt::Debug for Settings {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.debug_struct("Settings")
+ // Instead of printing the font bytes, we simply show a `bool` indicating if using a default font or not.
+ .field("default_font", &self.default_font.is_none())
+ .field("default_text_size", &self.default_text_size)
+ .field("text_multithreading", &self.text_multithreading)
+ .field("antialiasing", &self.antialiasing)
+ .finish()
+ }
+}
+
impl Settings {
/// Creates new [`Settings`] using environment configuration.
///
diff --git a/glow/src/text.rs b/glow/src/text.rs
index 0d45d61b..37ccdece 100644
--- a/glow/src/text.rs
+++ b/glow/src/text.rs
@@ -54,7 +54,7 @@ impl Pipeline {
#[cfg(target_arch = "wasm32")]
let draw_brush_builder = draw_brush_builder.draw_cache_align_4x4(true);
- let draw_brush = draw_brush_builder.build(&gl);
+ let draw_brush = draw_brush_builder.build(gl);
let measure_brush =
glyph_brush::GlyphBrushBuilder::using_font(font).build();
@@ -180,7 +180,8 @@ impl Pipeline {
}
b_count += utf8_len;
}
- return byte_index;
+
+ byte_index
};
if !nearest_only {
diff --git a/glow/src/widget.rs b/glow/src/widget.rs
deleted file mode 100644
index ee2810f9..00000000
--- a/glow/src/widget.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-//! Use the widgets supported out-of-the-box.
-//!
-//! # Re-exports
-//! For convenience, the contents of this module are available at the root
-//! module. Therefore, you can directly type:
-//!
-//! ```
-//! use iced_glow::{button, Button};
-//! ```
-use crate::Renderer;
-
-pub mod button;
-pub mod checkbox;
-pub mod container;
-pub mod pane_grid;
-pub mod pick_list;
-pub mod progress_bar;
-pub mod radio;
-pub mod rule;
-pub mod scrollable;
-pub mod slider;
-pub mod text_input;
-pub mod toggler;
-pub mod tooltip;
-
-#[doc(no_inline)]
-pub use button::Button;
-#[doc(no_inline)]
-pub use checkbox::Checkbox;
-#[doc(no_inline)]
-pub use container::Container;
-#[doc(no_inline)]
-pub use pane_grid::PaneGrid;
-#[doc(no_inline)]
-pub use pick_list::PickList;
-#[doc(no_inline)]
-pub use progress_bar::ProgressBar;
-#[doc(no_inline)]
-pub use radio::Radio;
-#[doc(no_inline)]
-pub use rule::Rule;
-#[doc(no_inline)]
-pub use scrollable::Scrollable;
-#[doc(no_inline)]
-pub use slider::Slider;
-#[doc(no_inline)]
-pub use text_input::TextInput;
-#[doc(no_inline)]
-pub use toggler::Toggler;
-#[doc(no_inline)]
-pub use tooltip::Tooltip;
-
-#[cfg(feature = "canvas")]
-#[cfg_attr(docsrs, doc(cfg(feature = "canvas")))]
-pub mod canvas;
-
-#[cfg(feature = "canvas")]
-#[doc(no_inline)]
-pub use canvas::Canvas;
-
-#[cfg(feature = "qr_code")]
-#[cfg_attr(docsrs, doc(cfg(feature = "qr_code")))]
-pub mod qr_code;
-
-#[cfg(feature = "qr_code")]
-#[doc(no_inline)]
-pub use qr_code::QRCode;
-
-pub use iced_native::widget::{Image, Space};
-
-/// A container that distributes its contents vertically.
-pub type Column<'a, Message> =
- iced_native::widget::Column<'a, Message, Renderer>;
-
-/// A container that distributes its contents horizontally.
-pub type Row<'a, Message> = iced_native::widget::Row<'a, Message, Renderer>;
-
-/// A paragraph of text.
-pub type Text = iced_native::widget::Text<Renderer>;
diff --git a/glow/src/widget/button.rs b/glow/src/widget/button.rs
deleted file mode 100644
index f11ff25e..00000000
--- a/glow/src/widget/button.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//! Allow your users to perform actions by pressing a button.
-//!
-//! A [`Button`] has some local [`State`].
-use crate::Renderer;
-
-pub use iced_graphics::button::{Style, StyleSheet};
-pub use iced_native::widget::button::State;
-
-/// A widget that produces a message when clicked.
-///
-/// This is an alias of an `iced_native` button with an `iced_wgpu::Renderer`.
-pub type Button<'a, Message> =
- iced_native::widget::Button<'a, Message, Renderer>;
diff --git a/glow/src/widget/canvas.rs b/glow/src/widget/canvas.rs
deleted file mode 100644
index 399dd19c..00000000
--- a/glow/src/widget/canvas.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//! Draw 2D graphics for your users.
-//!
-//! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a
-//! [`Frame`]. It can be used for animation, data visualization, game graphics,
-//! and more!
-pub use iced_graphics::canvas::*;
diff --git a/glow/src/widget/checkbox.rs b/glow/src/widget/checkbox.rs
deleted file mode 100644
index 76d572d9..00000000
--- a/glow/src/widget/checkbox.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//! Show toggle controls using checkboxes.
-use crate::Renderer;
-
-pub use iced_graphics::checkbox::{Style, StyleSheet};
-
-/// A box that can be checked.
-///
-/// This is an alias of an `iced_native` checkbox with an `iced_wgpu::Renderer`.
-pub type Checkbox<'a, Message> =
- iced_native::widget::Checkbox<'a, Message, Renderer>;
diff --git a/glow/src/widget/container.rs b/glow/src/widget/container.rs
deleted file mode 100644
index c16db50d..00000000
--- a/glow/src/widget/container.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//! Decorate content and apply alignment.
-use crate::Renderer;
-
-pub use iced_graphics::container::{Style, StyleSheet};
-
-/// An element decorating some content.
-///
-/// This is an alias of an `iced_native` container with a default
-/// `Renderer`.
-pub type Container<'a, Message> =
- iced_native::widget::Container<'a, Message, Renderer>;
diff --git a/glow/src/widget/pane_grid.rs b/glow/src/widget/pane_grid.rs
deleted file mode 100644
index 3c47acf0..00000000
--- a/glow/src/widget/pane_grid.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-//! Let your users split regions of your application and organize layout dynamically.
-//!
-//! [![Pane grid - Iced](https://thumbs.gfycat.com/MixedFlatJellyfish-small.gif)](https://gfycat.com/mixedflatjellyfish)
-//!
-//! # Example
-//! The [`pane_grid` example] showcases how to use a [`PaneGrid`] with resizing,
-//! drag and drop, and hotkey support.
-//!
-//! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.3/examples/pane_grid
-use crate::Renderer;
-
-pub use iced_graphics::pane_grid::{
- Axis, Configuration, Direction, DragEvent, Line, Node, Pane, ResizeEvent,
- Split, State, StyleSheet,
-};
-
-/// A collection of panes distributed using either vertical or horizontal splits
-/// to completely fill the space available.
-///
-/// [![Pane grid - Iced](https://thumbs.gfycat.com/MixedFlatJellyfish-small.gif)](https://gfycat.com/mixedflatjellyfish)
-///
-/// This is an alias of an `iced_native` pane grid with an `iced_wgpu::Renderer`.
-pub type PaneGrid<'a, Message> =
- iced_native::widget::PaneGrid<'a, Message, Renderer>;
-
-/// The content of a [`Pane`].
-pub type Content<'a, Message> =
- iced_native::widget::pane_grid::Content<'a, Message, Renderer>;
-
-/// The title bar of a [`Pane`].
-pub type TitleBar<'a, Message> =
- iced_native::widget::pane_grid::TitleBar<'a, Message, Renderer>;
diff --git a/glow/src/widget/pick_list.rs b/glow/src/widget/pick_list.rs
deleted file mode 100644
index 4d93be68..00000000
--- a/glow/src/widget/pick_list.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//! Display a dropdown list of selectable values.
-pub use iced_native::widget::pick_list::State;
-
-pub use iced_graphics::overlay::menu::Style as Menu;
-pub use iced_graphics::pick_list::{Style, StyleSheet};
-
-/// A widget allowing the selection of a single value from a list of options.
-pub type PickList<'a, T, Message> =
- iced_native::widget::PickList<'a, T, Message, crate::Renderer>;
diff --git a/glow/src/widget/progress_bar.rs b/glow/src/widget/progress_bar.rs
deleted file mode 100644
index 413e6fb7..00000000
--- a/glow/src/widget/progress_bar.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//! Allow your users to visually track the progress of a computation.
-//!
-//! A [`ProgressBar`] has a range of possible values and a current value,
-//! as well as a length, height and style.
-
-pub use iced_graphics::progress_bar::*;
diff --git a/glow/src/widget/qr_code.rs b/glow/src/widget/qr_code.rs
deleted file mode 100644
index 7b1c2408..00000000
--- a/glow/src/widget/qr_code.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-//! Encode and display information in a QR code.
-pub use iced_graphics::qr_code::*;
diff --git a/glow/src/widget/radio.rs b/glow/src/widget/radio.rs
deleted file mode 100644
index 9ef1d7a5..00000000
--- a/glow/src/widget/radio.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//! Create choices using radio buttons.
-use crate::Renderer;
-
-pub use iced_graphics::radio::{Style, StyleSheet};
-
-/// A circular button representing a choice.
-///
-/// This is an alias of an `iced_native` radio button with an
-/// `iced_wgpu::Renderer`.
-pub type Radio<'a, Message> = iced_native::widget::Radio<'a, Message, Renderer>;
diff --git a/glow/src/widget/rule.rs b/glow/src/widget/rule.rs
deleted file mode 100644
index 40281773..00000000
--- a/glow/src/widget/rule.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-//! Display a horizontal or vertical rule for dividing content.
-
-pub use iced_graphics::rule::*;
diff --git a/glow/src/widget/scrollable.rs b/glow/src/widget/scrollable.rs
deleted file mode 100644
index d5635ec5..00000000
--- a/glow/src/widget/scrollable.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//! Navigate an endless amount of content with a scrollbar.
-use crate::Renderer;
-
-pub use iced_graphics::scrollable::{Scrollbar, Scroller, StyleSheet};
-pub use iced_native::widget::scrollable::State;
-
-/// A widget that can vertically display an infinite amount of content
-/// with a scrollbar.
-///
-/// This is an alias of an `iced_native` scrollable with a default
-/// `Renderer`.
-pub type Scrollable<'a, Message> =
- iced_native::widget::Scrollable<'a, Message, Renderer>;
diff --git a/glow/src/widget/slider.rs b/glow/src/widget/slider.rs
deleted file mode 100644
index 2fb3d5d9..00000000
--- a/glow/src/widget/slider.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-//! Display an interactive selector of a single value from a range of values.
-//!
-//! A [`Slider`] has some local [`State`].
-pub use iced_graphics::slider::{Handle, HandleShape, Style, StyleSheet};
-pub use iced_native::widget::slider::{Slider, State};
diff --git a/glow/src/widget/text_input.rs b/glow/src/widget/text_input.rs
deleted file mode 100644
index 5560e3e0..00000000
--- a/glow/src/widget/text_input.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//! Display fields that can be filled with text.
-//!
-//! A [`TextInput`] has some local [`State`].
-use crate::Renderer;
-
-pub use iced_graphics::text_input::{Style, StyleSheet};
-pub use iced_native::widget::text_input::State;
-
-/// A field that can be filled with text.
-///
-/// This is an alias of an `iced_native` text input with an `iced_wgpu::Renderer`.
-pub type TextInput<'a, Message> =
- iced_native::widget::TextInput<'a, Message, Renderer>;
diff --git a/glow/src/widget/toggler.rs b/glow/src/widget/toggler.rs
deleted file mode 100644
index 40379025..00000000
--- a/glow/src/widget/toggler.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//! Show toggle controls using togglers.
-use crate::Renderer;
-
-pub use iced_graphics::toggler::{Style, StyleSheet};
-
-/// A toggler that can be toggled.
-///
-/// This is an alias of an `iced_native` checkbox with an `iced_wgpu::Renderer`.
-pub type Toggler<'a, Message> =
- iced_native::widget::Toggler<'a, Message, Renderer>;
diff --git a/glow/src/widget/tooltip.rs b/glow/src/widget/tooltip.rs
deleted file mode 100644
index c6af3903..00000000
--- a/glow/src/widget/tooltip.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//! Display a widget over another.
-/// A widget allowing the selection of a single value from a list of options.
-pub type Tooltip<'a, Message> =
- iced_native::widget::Tooltip<'a, Message, crate::Renderer>;
-
-pub use iced_native::widget::tooltip::Position;
diff --git a/glow/src/window/compositor.rs b/glow/src/window/compositor.rs
index 44019fb2..f6afaa68 100644
--- a/glow/src/window/compositor.rs
+++ b/glow/src/window/compositor.rs
@@ -1,18 +1,21 @@
use crate::{Backend, Color, Error, Renderer, Settings, Viewport};
-use core::ffi::c_void;
use glow::HasContext;
-use iced_graphics::{Antialiasing, Size};
+use iced_graphics::{compositor, Antialiasing, Size};
+
+use core::ffi::c_void;
+use std::marker::PhantomData;
/// A window graphics backend for iced powered by `glow`.
#[allow(missing_debug_implementations)]
-pub struct Compositor {
+pub struct Compositor<Theme> {
gl: glow::Context,
+ theme: PhantomData<Theme>,
}
-impl iced_graphics::window::GLCompositor for Compositor {
+impl<Theme> iced_graphics::window::GLCompositor for Compositor<Theme> {
type Settings = Settings;
- type Renderer = Renderer;
+ type Renderer = Renderer<Theme>;
unsafe fn new(
settings: Self::Settings,
@@ -20,6 +23,8 @@ impl iced_graphics::window::GLCompositor for Compositor {
) -> Result<(Self, Self::Renderer), Error> {
let gl = glow::Context::from_loader_function(loader_function);
+ log::info!("{:#?}", settings);
+
let version = gl.version();
log::info!("Version: {:?}", version);
log::info!("Embedded: {}", version.is_embedded);
@@ -44,7 +49,13 @@ impl iced_graphics::window::GLCompositor for Compositor {
let renderer = Renderer::new(Backend::new(&gl, settings));
- Ok((Self { gl }, renderer))
+ Ok((
+ Self {
+ gl,
+ theme: PhantomData,
+ },
+ renderer,
+ ))
}
fn sample_count(settings: &Settings) -> u32 {
@@ -65,6 +76,15 @@ impl iced_graphics::window::GLCompositor for Compositor {
}
}
+ fn fetch_information(&self) -> compositor::Information {
+ let adapter = unsafe { self.gl.get_parameter_string(glow::RENDERER) };
+
+ compositor::Information {
+ backend: format!("{:?}", self.gl.version()),
+ adapter,
+ }
+ }
+
fn present<T: AsRef<str>>(
&mut self,
renderer: &mut Self::Renderer,