shell: Raise X11 surfaces on workspace activate

This commit is contained in:
Victoria Brekenfeld 2023-11-22 12:49:19 +01:00 committed by Victoria Brekenfeld
parent 37623f063f
commit 8da782df67
2 changed files with 33 additions and 2 deletions

View file

@ -38,14 +38,17 @@ use smithay::{
desktop::{layer_map_for_output, space::SpaceElement},
input::{pointer::GrabStartData as PointerGrabStartData, Seat},
output::Output,
reexports::wayland_server::{protocol::wl_surface::WlSurface, Client, Resource},
reexports::{
wayland_server::{protocol::wl_surface::WlSurface, Client, Resource},
x11rb::xcb_ffi::ConnectionError,
},
utils::{Buffer as BufferCoords, IsAlive, Logical, Physical, Point, Rectangle, Scale, Size},
wayland::{
compositor::{add_blocker, Blocker, BlockerState},
seat::WaylandFocus,
xdg_activation::{XdgActivationState, XdgActivationToken},
},
xwayland::X11Surface,
xwayland::{X11Surface, X11Wm},
};
use std::{
collections::{HashMap, HashSet, VecDeque},
@ -866,6 +869,24 @@ 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,