From 866f9eec5d8b4764013d24b33a48b72918e76950 Mon Sep 17 00:00:00 2001 From: Ottatop Date: Sat, 9 Sep 2023 04:34:17 -0500 Subject: [PATCH] Fix window render order --- src/backend/udev.rs | 12 ++++++++++-- src/backend/winit.rs | 10 +++++++++- src/input.rs | 1 + src/layout.rs | 10 +++++++++- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/backend/udev.rs b/src/backend/udev.rs index 320cd1e..2022341 100644 --- a/src/backend/udev.rs +++ b/src/backend/udev.rs @@ -72,7 +72,7 @@ use smithay::{ backend::GlobalId, protocol::wl_surface::WlSurface, Display, DisplayHandle, }, }, - utils::{Clock, DeviceFd, Logical, Monotonic, Physical, Point, Rectangle, Transform}, + utils::{Clock, DeviceFd, IsAlive, Logical, Monotonic, Physical, Point, Rectangle, Transform}, wayland::{ dmabuf::{DmabufFeedback, DmabufFeedbackBuilder, DmabufGlobal, DmabufState}, input_method::{InputMethodHandle, InputMethodSeat}, @@ -1332,10 +1332,18 @@ impl State { return; }; + let windows = self + .focus_state + .focus_stack + .iter() + .filter(|win| win.alive()) + .cloned() + .collect::>(); + let result = render_surface( &mut self.cursor_status, &self.space, - &self.windows, + &windows, self.dnd_icon.as_ref(), &self.focus_state.focus_stack, surface, diff --git a/src/backend/winit.rs b/src/backend/winit.rs index d7a2307..d8aa2a5 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -248,9 +248,17 @@ pub fn run_winit() -> anyhow::Result<()> { state.focus_state.fix_up_focus(&mut state.space); + let windows = state + .focus_state + .focus_stack + .iter() + .filter(|win| win.alive()) + .cloned() + .collect::>(); + let output_render_elements = crate::render::generate_render_elements( &state.space, - &state.windows, + &windows, state.pointer_location, &mut state.cursor_status, state.dnd_icon.as_ref(), diff --git a/src/input.rs b/src/input.rs index d7b2482..176f932 100644 --- a/src/input.rs +++ b/src/input.rs @@ -20,6 +20,7 @@ use smithay::{ input::{ keyboard::{keysyms, FilterResult}, pointer::{AxisFrame, ButtonEvent, MotionEvent}, + SeatHandler, }, reexports::wayland_protocols::xdg::shell::server::xdg_toplevel::ResizeEdge, utils::{Logical, Point, SERIAL_COUNTER}, diff --git a/src/layout.rs b/src/layout.rs index ec66bd2..933de52 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -166,12 +166,20 @@ impl State { // schedule on all idle self.schedule( move |_dt| { - // tracing::debug!("Waiting for all to be idle"); + tracing::debug!("Waiting for all to be idle"); let all_idle = pending_wins .iter() .filter(|(_, win)| win.alive()) .all(|(_, win)| win.with_state(|state| state.loc_request_state.is_idle())); + let num_not_idle = pending_wins + .iter() + .filter(|(_, win)| win.alive()) + .filter(|(_, win)| !win.with_state(|state| state.loc_request_state.is_idle())) + .count(); + + tracing::debug!("{num_not_idle} not idle"); + all_idle }, move |dt| {