From 44d87d4725a6b456d41fe2e5fd8c9daae203dd9f Mon Sep 17 00:00:00 2001 From: Ottatop Date: Sat, 2 Sep 2023 21:45:03 -0500 Subject: [PATCH] Fix black screen on discord on wayland --- src/handlers/xdg_shell.rs | 3 +++ src/layout.rs | 31 ++++++++----------------------- src/render.rs | 10 ++++++++++ 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index 2afab3a..02cb675 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -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); diff --git a/src/layout.rs b/src/layout.rs index 13f6e97..4ac2ef6 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -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); } } diff --git a/src/render.rs b/src/render.rs index b0fc997..6663d3a 100644 --- a/src/render.rs +++ b/src/render.rs @@ -277,6 +277,10 @@ where let mut output_render_elements = Vec::>>::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 } };