From c6e6f1b181f1cf5782615efaa933812ff19f29bc Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Fri, 22 Dec 2023 15:43:38 +0000 Subject: [PATCH] shell: Fix x11 stacking order of sticky windows on workspace switch --- src/shell/mod.rs | 25 ++++++++++++++++++++++++- src/shell/workspace.rs | 24 +----------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/shell/mod.rs b/src/shell/mod.rs index b5ede50f..d0aa4b6d 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -1151,7 +1151,30 @@ impl Shell { .as_mut() .and_then(|state| state.xwm.as_mut()) { - let _ = set.workspaces[idx].raise_x11_windows(xwm); + { + for window in set.workspaces[set.active] + .tiling_layer + .mapped() + .map(|(_, w, _)| w) + .chain(set.workspaces[set.active].floating_layer.space.elements()) + { + if let CosmicSurface::X11(surf) = window.active_window() { + let _ = xwm.raise_window(&surf); + } + } + for window in set.sticky_layer.space.elements() { + if let CosmicSurface::X11(surf) = window.active_window() { + let _ = xwm.raise_window(&surf); + } + } + if let Some(CosmicSurface::X11(ref surf)) = set.workspaces[set.active] + .fullscreen + .as_ref() + .map(|f| &f.surface) + { + let _ = xwm.raise_window(surf); + } + } for surface in &self.override_redirect_windows { let _ = xwm.raise_window(surface); } diff --git a/src/shell/workspace.rs b/src/shell/workspace.rs index 098c51c9..8917e917 100644 --- a/src/shell/workspace.rs +++ b/src/shell/workspace.rs @@ -36,17 +36,13 @@ use smithay::{ desktop::{layer_map_for_output, space::SpaceElement}, input::Seat, output::Output, - reexports::{ - wayland_server::{protocol::wl_surface::WlSurface, Client, Resource}, - x11rb::errors::ConnectionError, - }, + reexports::wayland_server::{protocol::wl_surface::WlSurface, Client, Resource}, utils::{Buffer as BufferCoords, IsAlive, Logical, Physical, Point, Rectangle, Scale, Size}, wayland::{ compositor::{add_blocker, Blocker, BlockerState}, seat::WaylandFocus, xdg_activation::{XdgActivationState, XdgActivationToken}, }, - xwayland::X11Wm, }; use std::{ collections::{HashMap, HashSet, VecDeque}, @@ -771,24 +767,6 @@ impl Workspace { } } - pub fn raise_x11_windows(&mut self, xwm: &mut X11Wm) -> Result<(), ConnectionError> { - for window in self - .tiling_layer - .mapped() - .map(|(_, w, _)| w) - .chain(self.floating_layer.space.elements()) - { - if let CosmicSurface::X11(surf) = window.active_window() { - xwm.raise_window(&surf)?; - } - } - if let Some(CosmicSurface::X11(ref surf)) = self.fullscreen.as_ref().map(|f| &f.surface) { - xwm.raise_window(surf)?; - } - - Ok(()) - } - pub fn render<'a, R>( &self, renderer: &mut R,