xwm: Fix stacking order

This commit is contained in:
Victoria Brekenfeld 2023-10-25 15:28:40 +02:00
parent ffb7bcfc91
commit 4f076f73d9
5 changed files with 6 additions and 36 deletions

View file

@ -3,7 +3,6 @@ use crate::{
state::Common,
utils::prelude::*,
wayland::handlers::xdg_shell::PopupGrabData,
xwayland::XWaylandState,
};
use indexmap::IndexSet;
use smithay::{
@ -137,11 +136,7 @@ impl Shell {
}
}
fn update_active<'a, 'b>(
&mut self,
seats: impl Iterator<Item = &'a Seat<State>>,
mut xwm: Option<&'b mut XWaylandState>,
) {
fn update_active<'a, 'b>(&mut self, seats: impl Iterator<Item = &'a Seat<State>>) {
// update activate status
let focused_windows = seats
.flat_map(|seat| {
@ -165,11 +160,6 @@ impl Shell {
// TODO: Add self.workspaces.active_workspaces()
let workspace = self.workspaces.active_mut(&output);
for focused in focused_windows.iter() {
if let CosmicSurface::X11(window) = focused.active_window() {
if let Some(xwm) = xwm.as_mut().and_then(|state| state.xwm.as_mut()) {
let _ = xwm.raise_window(&window);
}
}
raise_with_children(&mut workspace.floating_layer, focused);
}
for window in workspace.mapped() {
@ -212,10 +202,7 @@ impl Common {
) {
Shell::set_focus(state, target, active_seat, serial);
let seats = state.common.seats().cloned().collect::<Vec<_>>();
state
.common
.shell
.update_active(seats.iter(), state.common.xwayland_state.as_mut());
state.common.shell.update_active(seats.iter());
}
pub fn refresh_focus(state: &mut State) {
@ -359,9 +346,6 @@ impl Common {
}
let seats = state.common.seats().cloned().collect::<Vec<_>>();
state
.common
.shell
.update_active(seats.iter(), state.common.xwayland_state.as_mut())
state.common.shell.update_active(seats.iter())
}
}

View file

@ -6,7 +6,6 @@ use std::{
sync::atomic::{AtomicBool, Ordering},
time::{Duration, Instant},
};
use tracing::warn;
use wayland_backend::server::ClientId;
use cosmic_protocols::workspace::v1::server::zcosmic_workspace_handle_v1::State as WState;
@ -1402,19 +1401,6 @@ impl Shell {
workspace.fullscreen_request(&mapped.active_window(), None);
}
if let CosmicSurface::X11(ref surface) = window {
if let Some(xwm) = state
.common
.xwayland_state
.as_mut()
.and_then(|state| state.xwm.as_mut())
{
if let Err(err) = xwm.raise_window(surface) {
warn!(?err, "Failed to update Xwayland stacking order.");
}
}
}
Shell::set_focus(state, Some(&KeyboardFocusTarget::from(mapped)), &seat, None);
let active_space = state.common.shell.active_space(&output);

View file

@ -1072,7 +1072,7 @@ impl Workspace {
if let Some(xwm) = xwm_state.and_then(|state| state.xwm.as_mut()) {
if let Err(err) =
xwm.update_stacking_order_upwards(window_elements.iter().map(|e| e.id()))
xwm.update_stacking_order_upwards(window_elements.iter().rev().map(|e| e.id()))
{
warn!(
wm_id = ?xwm.id(),