Merge pull request #1902 from iexavl/fullscreen_panic_fix

Fullscreen request unreachable code crash
This commit is contained in:
Levi Portenier 2026-02-17 09:01:38 -07:00 committed by GitHub
commit ef14b7e294
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 15 deletions

View file

@ -262,6 +262,7 @@ pub struct PendingLayer {
pub struct Shell {
pub workspaces: Workspaces,
// Can't make this into a HashSet. See https://github.com/pop-os/cosmic-comp/pull/1902
pub pending_windows: Vec<PendingWindow>,
pub pending_layers: Vec<PendingLayer>,
pub pending_activations: HashMap<ActivationKey, ActivationContext>,

View file

@ -44,13 +44,21 @@ impl XdgShellHandler for State {
fn new_toplevel(&mut self, surface: ToplevelSurface) {
let mut shell = self.common.shell.write();
let seat = shell.seats.last_active().clone();
let window = CosmicSurface::from(surface);
shell.pending_windows.push(PendingWindow {
surface: window,
seat,
fullscreen: None,
maximized: false,
});
if shell
.pending_windows
.iter()
.find(|w| &w.surface == &surface)
.is_none()
{
let surface = CosmicSurface::from(surface);
shell.pending_windows.push(PendingWindow {
surface,
seat,
fullscreen: None,
maximized: false,
})
}
// We will position the window after the first commit, when we know its size hints
}

View file

@ -808,14 +808,20 @@ impl XwmHandler for State {
*context,
);
}
let surface = CosmicSurface::from(window);
shell.pending_windows.push(PendingWindow {
surface,
seat,
fullscreen: None,
maximized: false,
});
if shell
.pending_windows
.iter()
.find(|w| w.surface == window)
.is_none()
{
let surface = CosmicSurface::from(window);
shell.pending_windows.push(PendingWindow {
surface,
seat,
fullscreen: None,
maximized: false,
})
}
}
fn map_window_notify(&mut self, _xwm: XwmId, surface: X11Surface) {
@ -875,6 +881,11 @@ impl XwmHandler for State {
let seat = shell.seats.last_active().clone();
if let Some(pending) =
shell.unmap_surface(&window, &seat, &mut self.common.toplevel_info_state)
&& shell
.pending_windows
.iter()
.find(|w| &w.surface == &pending.surface)
.is_none()
{
shell.pending_windows.push(pending);
}