summaryrefslogtreecommitdiffstats
path: root/glutin/src/application.rs
diff options
context:
space:
mode:
authorLibravatar bungoboingo <shankern@protonmail.com>2023-01-05 15:26:28 -0800
committerLibravatar bungoboingo <shankern@protonmail.com>2023-01-09 11:28:07 -0800
commitec41918ec40bddaba81235372f1566da59fd09f2 (patch)
treefb530943ccf14dfec3820bf65f71a9572fd3d8be /glutin/src/application.rs
parent1944e98f82b7efd5b268e04ba5ced065e55a218e (diff)
downloadiced-ec41918ec40bddaba81235372f1566da59fd09f2.tar.gz
iced-ec41918ec40bddaba81235372f1566da59fd09f2.tar.bz2
iced-ec41918ec40bddaba81235372f1566da59fd09f2.zip
Implemented window title update functionality for multiwindow.
Diffstat (limited to '')
-rw-r--r--glutin/src/application.rs33
1 files changed, 21 insertions, 12 deletions
diff --git a/glutin/src/application.rs b/glutin/src/application.rs
index 45ff37f0..f43a47b9 100644
--- a/glutin/src/application.rs
+++ b/glutin/src/application.rs
@@ -245,18 +245,7 @@ where
)
})?;
- let (width, height) = window.inner_size().into();
- let surface_attributes =
- SurfaceAttributesBuilder::<WindowSurface>::new()
- .with_srgb(Some(true))
- .build(
- window_handle,
- NonZeroU32::new(width).unwrap_or(ONE),
- NonZeroU32::new(height).unwrap_or(ONE),
- );
-
- let surface = display
- .create_window_surface(configuration.as_ref(), &surface_attributes)
+ let surface = gl_surface(&display, configuration.as_ref(), &window)
.map_err(|error| {
Error::GraphicsCreationFailed(
iced_graphics::Error::BackendError(format!(
@@ -616,3 +605,23 @@ async fn run_instance<A, E, C>(
// Manually drop the user interface
drop(ManuallyDrop::into_inner(user_interface));
}
+
+#[allow(unsafe_code)]
+/// Creates a new [`glutin::Surface<WindowSurface>`].
+pub fn gl_surface(
+ display: &Display,
+ gl_config: &Config,
+ window: &winit::window::Window,
+) -> Result<Surface<WindowSurface>, glutin::error::Error> {
+ let (width, height) = window.inner_size().into();
+
+ let surface_attributes = SurfaceAttributesBuilder::<WindowSurface>::new()
+ .with_srgb(Some(true))
+ .build(
+ window.raw_window_handle(),
+ NonZeroU32::new(width).unwrap_or(ONE),
+ NonZeroU32::new(height).unwrap_or(ONE),
+ );
+
+ unsafe { display.create_window_surface(gl_config, &surface_attributes) }
+}