mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-27 21:58:18 +01:00
Fix reversed order of window rendering
This commit is contained in:
parent
ce5ed0db69
commit
87a8f29298
6 changed files with 30 additions and 29 deletions
|
@ -236,6 +236,8 @@ pub fn run_winit() -> anyhow::Result<()> {
|
|||
let full_redraw = &mut backend.full_redraw;
|
||||
*full_redraw = full_redraw.saturating_sub(1);
|
||||
|
||||
state.focus_state.fix_up_focus(&mut state.space);
|
||||
|
||||
let output_render_elements = crate::render::generate_render_elements(
|
||||
&state.space,
|
||||
&state.windows,
|
||||
|
|
|
@ -50,9 +50,7 @@ impl FocusState {
|
|||
/// to back to correct their z locations.
|
||||
pub fn fix_up_focus(&self, space: &mut Space<WindowElement>) {
|
||||
for win in self.focus_stack.iter() {
|
||||
if let Some(loc) = space.element_location(win) {
|
||||
space.map_element(win.clone(), loc, false);
|
||||
}
|
||||
space.raise_element(win, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ impl CompositorHandler for State {
|
|||
|
||||
// correct focus layering
|
||||
// TODO: maybe do this at the end of every event loop cycle instead?
|
||||
self.focus_state.fix_up_focus(&mut self.space);
|
||||
// self.focus_state.fix_up_focus(&mut self.space);
|
||||
}
|
||||
|
||||
fn client_compositor_state<'a>(&self, client: &'a Client) -> &'a CompositorClientState {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use itertools::{Either, Itertools};
|
||||
use smithay::{
|
||||
desktop::layer_map_for_output,
|
||||
desktop::{layer_map_for_output, space::SpaceElement},
|
||||
output::Output,
|
||||
utils::{Logical, Point, Rectangle, Size},
|
||||
};
|
||||
|
@ -462,6 +462,20 @@ 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
|
||||
|
@ -469,6 +483,6 @@ impl State {
|
|||
.clone()
|
||||
.expect("no focused output");
|
||||
self.update_windows(&output);
|
||||
// self.re_layout(&output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -271,14 +271,8 @@ where
|
|||
overlay,
|
||||
} = layer_render_elements(output, renderer);
|
||||
|
||||
let tags = space
|
||||
.outputs()
|
||||
.flat_map(|op| {
|
||||
op.with_state(|state| state.focused_tags().cloned().collect::<Vec<_>>())
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let window_render_elements: Vec<WaylandSurfaceRenderElement<R>> =
|
||||
Tag::tag_render_elements(&tags, windows, space, renderer);
|
||||
Tag::tag_render_elements(windows, space, renderer);
|
||||
|
||||
let mut output_render_elements =
|
||||
Vec::<OutputRenderElements<R, WaylandSurfaceRenderElement<R>>>::new();
|
||||
|
|
11
src/tag.rs
11
src/tag.rs
|
@ -120,7 +120,6 @@ impl Tag {
|
|||
|
||||
/// Get the render_elements for the provided tags.
|
||||
pub fn tag_render_elements<R, C>(
|
||||
tags: &[Tag],
|
||||
windows: &[WindowElement],
|
||||
space: &Space<WindowElement>,
|
||||
renderer: &mut R,
|
||||
|
@ -132,14 +131,8 @@ impl Tag {
|
|||
{
|
||||
let elements = windows
|
||||
.iter()
|
||||
.filter(|win| {
|
||||
win.with_state(|state| {
|
||||
state
|
||||
.tags
|
||||
.iter()
|
||||
.any(|tag| tags.iter().any(|tag2| tag == tag2))
|
||||
})
|
||||
})
|
||||
.rev() // rev because I treat the focus stack backwards vs how the renderer orders it
|
||||
.filter(|win| win.is_on_active_tag(space.outputs()))
|
||||
.flat_map(|win| {
|
||||
// subtract win.geometry().loc to align decorations correctly
|
||||
let loc = (space.element_location(win).unwrap_or((0, 0).into())
|
||||
|
|
Loading…
Reference in a new issue