Avoid redrawing window twice on RedrawRequested
This commit is contained in:
parent
6c93efa2a9
commit
f7425db87e
1 changed files with 25 additions and 11 deletions
|
|
@ -881,16 +881,16 @@ async fn run_instance<P>(
|
||||||
let mut has_window_resized = false;
|
let mut has_window_resized = false;
|
||||||
|
|
||||||
for action in actions {
|
for action in actions {
|
||||||
has_window_resized = has_window_resized
|
if let Action::Window(
|
||||||
|| matches!(
|
runtime::window::Action::Resize(
|
||||||
action,
|
window_id,
|
||||||
Action::Window(
|
_,
|
||||||
runtime::window::Action::Resize(
|
),
|
||||||
_,
|
) = action
|
||||||
_
|
&& window_id == id
|
||||||
)
|
{
|
||||||
)
|
has_window_resized = true;
|
||||||
);
|
}
|
||||||
|
|
||||||
run_action(
|
run_action(
|
||||||
action,
|
action,
|
||||||
|
|
@ -909,6 +909,17 @@ async fn run_instance<P>(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (window_id, window) in
|
||||||
|
window_manager.iter_mut()
|
||||||
|
{
|
||||||
|
// We are already redrawing this window
|
||||||
|
if window_id == id {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.raw.request_redraw();
|
||||||
|
}
|
||||||
|
|
||||||
let Some(next_compositor) = compositor.as_mut()
|
let Some(next_compositor) = compositor.as_mut()
|
||||||
else {
|
else {
|
||||||
continue 'next_event;
|
continue 'next_event;
|
||||||
|
|
@ -1202,6 +1213,10 @@ async fn run_instance<P>(
|
||||||
&mut system_theme,
|
&mut system_theme,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (_id, window) in window_manager.iter_mut() {
|
||||||
|
window.raw.request_redraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(redraw_at) = window_manager.redraw_at() {
|
if let Some(redraw_at) = window_manager.redraw_at() {
|
||||||
|
|
@ -1731,7 +1746,6 @@ where
|
||||||
{
|
{
|
||||||
for (id, window) in window_manager.iter_mut() {
|
for (id, window) in window_manager.iter_mut() {
|
||||||
window.state.synchronize(program, id, &window.raw);
|
window.state.synchronize(program, id, &window.raw);
|
||||||
window.raw.request_redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
debug::theme_changed(|| {
|
debug::theme_changed(|| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue