Respect initial configure

This commit is contained in:
Ottatop 2023-08-31 20:42:58 -05:00
parent 39d5454a7f
commit 5744654cb1

View file

@ -92,49 +92,71 @@ impl XdgShellHandler for State {
// TODO: fix it so that reordering this doesn't break stuff // TODO: fix it so that reordering this doesn't break stuff
self.windows.push(window.clone()); self.windows.push(window.clone());
if let Some(focused_output) = self.focus_state.focused_output.clone() { let win_clone = window.clone();
// FIXME: ignoring initial configure here self.schedule(
self.update_windows(&focused_output); move |_data| {
BLOCKER_COUNTER.store(1, std::sync::atomic::Ordering::SeqCst); if let WindowElement::Wayland(window) = &win_clone {
tracing::debug!( let initial_configure_sent =
"blocker {}", compositor::with_states(window.toplevel().wl_surface(), |states| {
BLOCKER_COUNTER.load(std::sync::atomic::Ordering::SeqCst) states
); .data_map
for win in windows_on_output.iter() { .get::<smithay::wayland::shell::xdg::XdgToplevelSurfaceData>()
if let Some(surf) = win.wl_surface() { .expect("XdgToplevelSurfaceData wasn't in surface's data map")
compositor::add_blocker(&surf, crate::window::WindowBlocker); .lock()
.expect("Failed to lock Mutex<XdgToplevelSurfaceData>")
.initial_configure_sent
});
initial_configure_sent
} else {
true
} }
} },
let clone = window.clone(); |data| {
self.loop_handle.insert_idle(|data| { if let Some(focused_output) = data.state.focus_state.focused_output.clone() {
crate::state::schedule_on_commit(data, vec![clone], move |data| { data.state.update_windows(&focused_output);
BLOCKER_COUNTER.store(0, std::sync::atomic::Ordering::SeqCst); BLOCKER_COUNTER.store(1, std::sync::atomic::Ordering::SeqCst);
tracing::debug!( tracing::debug!(
"blocker {}", "blocker {}",
BLOCKER_COUNTER.load(std::sync::atomic::Ordering::SeqCst) BLOCKER_COUNTER.load(std::sync::atomic::Ordering::SeqCst)
); );
for client in windows_on_output for win in windows_on_output.iter() {
.iter() if let Some(surf) = win.wl_surface() {
.filter_map(|win| win.wl_surface()?.client()) compositor::add_blocker(&surf, crate::window::WindowBlocker);
{ }
data.state
.client_compositor_state(&client)
.blocker_cleared(&mut data.state, &data.display.handle())
} }
}) let clone = window.clone();
}); data.state.loop_handle.insert_idle(|data| {
} crate::state::schedule_on_commit(data, vec![clone], move |data| {
self.loop_handle.insert_idle(move |data| { BLOCKER_COUNTER.store(0, std::sync::atomic::Ordering::SeqCst);
data.state tracing::debug!(
.seat "blocker {}",
.get_keyboard() BLOCKER_COUNTER.load(std::sync::atomic::Ordering::SeqCst)
.expect("Seat had no keyboard") // FIXME: actually handle error );
.set_focus( for client in windows_on_output
&mut data.state, .iter()
Some(FocusTarget::Window(window)), .filter_map(|win| win.wl_surface()?.client())
SERIAL_COUNTER.next_serial(), {
); data.state
}); .client_compositor_state(&client)
.blocker_cleared(&mut data.state, &data.display.handle())
}
})
});
}
data.state.loop_handle.insert_idle(move |data| {
data.state
.seat
.get_keyboard()
.expect("Seat had no keyboard") // FIXME: actually handle error
.set_focus(
&mut data.state,
Some(FocusTarget::Window(window)),
SERIAL_COUNTER.next_serial(),
);
});
},
);
} }
fn toplevel_destroyed(&mut self, surface: ToplevelSurface) { fn toplevel_destroyed(&mut self, surface: ToplevelSurface) {