Fix black screen on discord on wayland

This commit is contained in:
Ottatop 2023-09-02 21:45:03 -05:00
parent 87a8f29298
commit 44d87d4725
3 changed files with 21 additions and 23 deletions

View file

@ -92,6 +92,8 @@ impl XdgShellHandler for State {
// TODO: fix it so that reordering this doesn't break stuff
self.windows.push(window.clone());
self.space.map_element(window.clone(), (0, 0), true);
let win_clone = window.clone();
// Let the initial configure happen before updating the windows
@ -115,6 +117,7 @@ impl XdgShellHandler for State {
}
},
|data| {
tracing::debug!("UPDATING WINDOWS");
if let Some(focused_output) = data.state.focus_state.focused_output.clone() {
data.state.update_windows(&focused_output);
BLOCKER_COUNTER.store(1, std::sync::atomic::Ordering::SeqCst);

View file

@ -2,7 +2,7 @@
use itertools::{Either, Itertools};
use smithay::{
desktop::{layer_map_for_output, space::SpaceElement},
desktop::layer_map_for_output,
output::Output,
utils::{Logical, Point, Rectangle, Size},
};
@ -462,27 +462,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
}
};