From 5b201889a8e4e5fbc87dde208e519ab1b78f3a9e Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Mon, 23 Jan 2023 22:53:15 +0100 Subject: [PATCH] xwm: Reflect raising floating x11 windows correctly --- src/shell/focus/mod.rs | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/shell/focus/mod.rs b/src/shell/focus/mod.rs index 611101b3..308f0f98 100644 --- a/src/shell/focus/mod.rs +++ b/src/shell/focus/mod.rs @@ -3,6 +3,7 @@ use crate::{ state::Common, utils::prelude::*, wayland::handlers::xdg_shell::PopupGrabData, + xwayland::XWaylandState, }; use indexmap::IndexSet; use smithay::{ @@ -14,6 +15,8 @@ use std::cell::RefCell; use self::target::{KeyboardFocusTarget, WindowGroup}; +use super::CosmicSurface; + pub mod target; #[derive(Debug, serde::Deserialize, Clone, Copy, PartialEq, Eq)] @@ -124,7 +127,11 @@ impl Shell { } } - fn update_active<'a>(&mut self, seats: impl Iterator>) { + fn update_active<'a, 'b>( + &mut self, + seats: impl Iterator>, + xwms: impl Iterator, + ) { // update activate status let focused_windows = seats .flat_map(|seat| { @@ -136,10 +143,18 @@ impl Shell { }) .collect::>(); + let mut xwms = xwms.collect::>(); for output in self.outputs.iter() { let workspace = self.workspaces.active_mut(output); for focused in focused_windows.iter() { if workspace.floating_layer.mapped().any(|m| m == focused) { + if let CosmicSurface::X11(window) = focused.active_window() { + for xwm in xwms.iter_mut().flat_map(|state| state.xwm.as_mut()) { + if Some(xwm.id()) == window.xwm_id() { + let _ = xwm.raise_window(&window); + } + } + } workspace.floating_layer.space.raise_element(focused, true); } } @@ -160,7 +175,10 @@ impl Common { ) { Shell::set_focus(state, target, active_seat, serial); let seats = state.common.seats().cloned().collect::>(); - state.common.shell.update_active(seats.iter()); + state + .common + .shell + .update_active(seats.iter(), state.common.xwayland_state.values_mut()); } pub fn refresh_focus(state: &mut State) { @@ -241,6 +259,9 @@ impl Common { } let seats = state.common.seats().cloned().collect::>(); - state.common.shell.update_active(seats.iter()) + state + .common + .shell + .update_active(seats.iter(), state.common.xwayland_state.values_mut()) } }