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
self.windows.push(window.clone());
if let Some(focused_output) = self.focus_state.focused_output.clone() {
// FIXME: ignoring initial configure here
self.update_windows(&focused_output);
BLOCKER_COUNTER.store(1, std::sync::atomic::Ordering::SeqCst);
tracing::debug!(
"blocker {}",
BLOCKER_COUNTER.load(std::sync::atomic::Ordering::SeqCst)
);
for win in windows_on_output.iter() {
if let Some(surf) = win.wl_surface() {
compositor::add_blocker(&surf, crate::window::WindowBlocker);
let win_clone = window.clone();
self.schedule(
move |_data| {
if let WindowElement::Wayland(window) = &win_clone {
let initial_configure_sent =
compositor::with_states(window.toplevel().wl_surface(), |states| {
states
.data_map
.get::<smithay::wayland::shell::xdg::XdgToplevelSurfaceData>()
.expect("XdgToplevelSurfaceData wasn't in surface's data map")
.lock()
.expect("Failed to lock Mutex<XdgToplevelSurfaceData>")
.initial_configure_sent
});
initial_configure_sent
} else {
true
}
}
let clone = window.clone();
self.loop_handle.insert_idle(|data| {
crate::state::schedule_on_commit(data, vec![clone], move |data| {
BLOCKER_COUNTER.store(0, std::sync::atomic::Ordering::SeqCst);
},
|data| {
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);
tracing::debug!(
"blocker {}",
BLOCKER_COUNTER.load(std::sync::atomic::Ordering::SeqCst)
);
for client in windows_on_output
.iter()
.filter_map(|win| win.wl_surface()?.client())
{
data.state
.client_compositor_state(&client)
.blocker_cleared(&mut data.state, &data.display.handle())
for win in windows_on_output.iter() {
if let Some(surf) = win.wl_surface() {
compositor::add_blocker(&surf, crate::window::WindowBlocker);
}
}
})
});
}
self.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(),
);
});
let clone = window.clone();
data.state.loop_handle.insert_idle(|data| {
crate::state::schedule_on_commit(data, vec![clone], move |data| {
BLOCKER_COUNTER.store(0, std::sync::atomic::Ordering::SeqCst);
tracing::debug!(
"blocker {}",
BLOCKER_COUNTER.load(std::sync::atomic::Ordering::SeqCst)
);
for client in windows_on_output
.iter()
.filter_map(|win| win.wl_surface()?.client())
{
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) {