summaryrefslogtreecommitdiffstats
path: root/graphics/src/compositor.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-24 08:04:28 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-24 08:04:28 +0100
commit4f5b63f1f4cd7d3ab72289c697f4abc767114eca (patch)
tree876f9502936b24f63ef21bb2b41e16b222750444 /graphics/src/compositor.rs
parent441e9237cd1c9c9b61d9b144b5b4dafa236ace28 (diff)
downloadiced-4f5b63f1f4cd7d3ab72289c697f4abc767114eca.tar.gz
iced-4f5b63f1f4cd7d3ab72289c697f4abc767114eca.tar.bz2
iced-4f5b63f1f4cd7d3ab72289c697f4abc767114eca.zip
Reintroduce backend selection through `ICED_BACKEND` env var
Diffstat (limited to '')
-rw-r--r--graphics/src/compositor.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/graphics/src/compositor.rs b/graphics/src/compositor.rs
index 8c67cd16..86472a58 100644
--- a/graphics/src/compositor.rs
+++ b/graphics/src/compositor.rs
@@ -20,6 +20,18 @@ pub trait Compositor: Sized {
fn new<W: Window + Clone>(
settings: Settings,
compatible_window: W,
+ ) -> impl Future<Output = Result<Self, Error>> {
+ Self::with_backend(settings, compatible_window, None)
+ }
+
+ /// Creates a new [`Compositor`] with a backend preference.
+ ///
+ /// If the backend does not match the preference, it will return
+ /// [`Error::GraphicsAdapterNotFound`].
+ fn with_backend<W: Window + Clone>(
+ _settings: Settings,
+ _compatible_window: W,
+ _backend: Option<&str>,
) -> impl Future<Output = Result<Self, Error>>;
/// Creates a [`Self::Renderer`] for the [`Compositor`].
@@ -130,9 +142,10 @@ impl Compositor for () {
type Renderer = ();
type Surface = ();
- async fn new<W: Window + Clone>(
+ async fn with_backend<W: Window + Clone>(
_settings: Settings,
_compatible_window: W,
+ _preffered_backend: Option<&str>,
) -> Result<Self, Error> {
Ok(())
}