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

2
Cargo.lock generated
View file

@ -3282,7 +3282,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
name = "smithay"
version = "0.3.0"
source = "git+https://github.com/pop-os/smithay?rev=217e0a4114#217e0a41148ad073e2b34fc8861c0532828e941f"
source = "git+https://github.com/pop-os/smithay?rev=406a40d6ec#406a40d6ec09723d8f1c73f3b7c9d62494cdbd13"
dependencies = [
"appendlist",
"bitflags",

View file

@ -70,4 +70,4 @@ debug = true
lto = "fat"
[patch."https://github.com/Smithay/smithay.git"]
smithay = { git = "https://github.com/pop-os/smithay", rev = "217e0a4114" }
smithay = { git = "https://github.com/pop-os/smithay", rev = "406a40d6ec" }

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) {