fix: reuse wgpu compositor across windows
This commit is contained in:
parent
dcf4cf0194
commit
f725961c87
1 changed files with 30 additions and 23 deletions
|
|
@ -864,28 +864,30 @@ async fn run_instance<P>(
|
||||||
platform_specific_handler.send_wayland(
|
platform_specific_handler.send_wayland(
|
||||||
platform_specific::Action::TrackWindow(window.clone(), id),
|
platform_specific::Action::TrackWindow(window.clone(), id),
|
||||||
);
|
);
|
||||||
match create_compositor::<P>(
|
if compositor.is_none() {
|
||||||
window.clone(),
|
match create_compositor::<P>(
|
||||||
CreateCompositor {
|
window.clone(),
|
||||||
proxy: &proxy,
|
CreateCompositor {
|
||||||
runtime: &mut runtime,
|
proxy: &proxy,
|
||||||
display_handle: &display_handle,
|
runtime: &mut runtime,
|
||||||
graphics_settings: &graphics_settings,
|
display_handle: &display_handle,
|
||||||
default_fonts: &default_fonts,
|
graphics_settings: &graphics_settings,
|
||||||
},
|
default_fonts: &default_fonts,
|
||||||
)
|
},
|
||||||
.await
|
)
|
||||||
{
|
.await
|
||||||
Ok(comp) => {
|
{
|
||||||
compositor = Some(comp);
|
Ok(comp) => {
|
||||||
}
|
compositor = Some(comp);
|
||||||
Err(error) => {
|
}
|
||||||
control_sender
|
Err(error) => {
|
||||||
.start_send(Control::Crash(
|
control_sender
|
||||||
Error::GraphicsCreationFailed(error),
|
.start_send(Control::Crash(
|
||||||
))
|
Error::GraphicsCreationFailed(error),
|
||||||
.expect("Send control message");
|
))
|
||||||
continue;
|
.expect("Send control message");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1014,6 +1016,7 @@ async fn run_instance<P>(
|
||||||
&mut is_window_opening,
|
&mut is_window_opening,
|
||||||
&mut system_theme,
|
&mut system_theme,
|
||||||
&mut platform_specific_handler,
|
&mut platform_specific_handler,
|
||||||
|
is_daemon,
|
||||||
);
|
);
|
||||||
if exited {
|
if exited {
|
||||||
runtime.track(None.into_iter());
|
runtime.track(None.into_iter());
|
||||||
|
|
@ -1171,6 +1174,7 @@ async fn run_instance<P>(
|
||||||
&mut is_window_opening,
|
&mut is_window_opening,
|
||||||
&mut system_theme,
|
&mut system_theme,
|
||||||
&mut platform_specific_handler,
|
&mut platform_specific_handler,
|
||||||
|
is_daemon,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1369,6 +1373,7 @@ async fn run_instance<P>(
|
||||||
&mut is_window_opening,
|
&mut is_window_opening,
|
||||||
&mut system_theme,
|
&mut system_theme,
|
||||||
&mut platform_specific_handler,
|
&mut platform_specific_handler,
|
||||||
|
is_daemon,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
window.state.update(&program, window.raw.as_ref(), &event);
|
window.state.update(&program, window.raw.as_ref(), &event);
|
||||||
|
|
@ -1562,6 +1567,7 @@ async fn run_instance<P>(
|
||||||
&mut is_window_opening,
|
&mut is_window_opening,
|
||||||
&mut system_theme,
|
&mut system_theme,
|
||||||
&mut platform_specific_handler,
|
&mut platform_specific_handler,
|
||||||
|
is_daemon,
|
||||||
);
|
);
|
||||||
if exited {
|
if exited {
|
||||||
runtime.track(None.into_iter());
|
runtime.track(None.into_iter());
|
||||||
|
|
@ -2106,6 +2112,7 @@ fn run_action<'a, P, C>(
|
||||||
is_window_opening: &mut bool,
|
is_window_opening: &mut bool,
|
||||||
system_theme: &mut theme::Mode,
|
system_theme: &mut theme::Mode,
|
||||||
platform_specific: &mut crate::platform_specific::PlatformSpecific,
|
platform_specific: &mut crate::platform_specific::PlatformSpecific,
|
||||||
|
is_daemon: bool,
|
||||||
) -> bool
|
) -> bool
|
||||||
where
|
where
|
||||||
P: Program,
|
P: Program,
|
||||||
|
|
@ -2190,7 +2197,7 @@ where
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if window_manager.is_empty() {
|
if window_manager.is_empty() && !is_daemon {
|
||||||
*compositor = None;
|
*compositor = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue