shell: Don't annouce toplevels before they have contents

This commit is contained in:
Victoria Brekenfeld 2023-01-27 18:15:54 +01:00
parent 5a8840b12e
commit 4ed3aceefc
5 changed files with 29 additions and 14 deletions

View file

@ -1059,6 +1059,7 @@ impl Shell {
let (window, seat) = state.common.shell.pending_windows.remove(pos);
let workspace = state.common.shell.workspaces.active_mut(output);
state.common.shell.toplevel_info_state.new_toplevel(&window);
state
.common
.shell

View file

@ -37,7 +37,6 @@ impl XdgShellHandler for State {
fn new_toplevel(&mut self, surface: ToplevelSurface) {
let seat = self.common.last_active_seat().clone();
let window = CosmicSurface::Wayland(Window::new(surface));
self.common.shell.toplevel_info_state.new_toplevel(&window);
self.common.shell.pending_windows.push((window, seat));
// We will position the window after the first commit, when we know its size hints
}

View file

@ -94,6 +94,7 @@ impl State {
self.common.event_loop_handle.clone(),
None,
std::iter::empty::<(OsString, OsString)>(),
//vec![("WAYLAND_DEBUG", "client")].into_iter(),
|map| {
if let Some(node) = drm_node {
map.insert_if_missing(|| node);
@ -141,31 +142,45 @@ impl XwmHandler for Data {
err
);
}
let surface = CosmicSurface::X11(window.clone());
if self
.state
.common
.shell
.element_for_surface(&CosmicSurface::X11(window.clone()))
.element_for_surface(&surface)
.is_some()
{
return;
}
let window = CosmicSurface::X11(window);
self.state
.common
.shell
.toplevel_info_state
.new_toplevel(&window);
let seat = self.state.common.last_active_seat().clone();
let output = seat.active_output();
self.state
.common
.shell
.pending_windows
.push((window.clone(), seat));
Shell::map_window(&mut self.state, &window, &output);
.push((surface, seat));
}
fn map_window_notify(&mut self, _xwm: XwmId, surface: X11Surface) {
if let Some((window, seat)) = self
.state
.common
.shell
.pending_windows
.iter()
.find(|(window, _)| {
if let CosmicSurface::X11(window) = window {
window == &surface
} else {
false
}
})
.cloned()
{
let output = seat.active_output();
Shell::map_window(&mut self.state, &window, &output);
}
}
fn mapped_override_redirect_window(&mut self, _xwm: XwmId, window: X11Surface) {