Implemented window title update functionality for multiwindow.
This commit is contained in:
parent
1944e98f82
commit
ec41918ec4
14 changed files with 270 additions and 243 deletions
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue