Skip to content

Commit

Permalink
shell: Raise X11 surfaces on workspace activate
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Nov 22, 2023
1 parent 0c28f62 commit 8834fc3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,16 @@ impl Shell {
set.workspaces[set.active].tiling_layer.cleanup_drag();
}
set.activate(idx, &mut self.workspace_state.update())?;
if let Some(xwm) = self
.xwayland_state
.as_mut()
.and_then(|state| state.xwm.as_mut())
{
let _ = set.workspaces[idx].raise_x11_windows(xwm);
for surface in &self.override_redirect_windows {
let _ = xwm.raise_window(surface);
}
}

let output_geo = output.geometry();
Ok(Some(
Expand Down
25 changes: 23 additions & 2 deletions src/shell/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8834fc3

Please sign in to comment.