Fix black screen on discord on wayland

This commit is contained in:
Ottatop 2023-09-02 21:45:03 -05:00
parent 861bd68839
commit 8f2ce70586
2 changed files with 18 additions and 23 deletions

View file

@ -4,7 +4,7 @@ use std::time::Duration;
use itertools::{Either, Itertools};
use smithay::{
desktop::{layer_map_for_output, space::SpaceElement},
desktop::layer_map_for_output,
output::Output,
reexports::wayland_server::Resource,
utils::{IsAlive, Logical, Point, Rectangle, Size},
@ -572,27 +572,12 @@ impl State {
}
}
// Some windows just don't want to commit on a timely basis, like VS Code on Wayland,
// unless their sizes change. In this case, if the two windows have the same size,
// just map them to the other's location instead of going through update_windows().
if win1.geometry().size == win2.geometry().size {
let win1_loc = self.space.element_location(win1);
let win2_loc = self.space.element_location(win2);
if let Some(win1_loc) = win1_loc {
if let Some(win2_loc) = win2_loc {
self.space.map_element(win1.clone(), win2_loc, false);
self.space.map_element(win2.clone(), win1_loc, false);
}
}
} else {
// TODO: don't use the focused output, use the outputs the two windows are on
let output = self
.focus_state
.focused_output
.clone()
.expect("no focused output");
self.update_windows(&output);
}
// TODO: don't use the focused output, use the outputs the two windows are on
let output = self
.focus_state
.focused_output
.clone()
.expect("no focused output");
self.update_windows(&output);
}
}

View file

@ -277,6 +277,10 @@ where
let mut output_render_elements =
Vec::<OutputRenderElements<R, WaylandSurfaceRenderElement<R>>>::new();
// let space_render_elements =
// smithay::desktop::space::space_render_elements(renderer, [space], output, 1.0)
// .expect("failed to get space_render_elements");
// Elements render from top to bottom
output_render_elements.extend(
@ -296,6 +300,12 @@ where
.map(OutputRenderElements::from),
);
// output_render_elements.extend(
// space_render_elements
// .into_iter()
// .map(OutputRenderElements::from),
// );
output_render_elements
}
};