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

2
Cargo.lock generated
View file

@ -3947,7 +3947,7 @@ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
[[package]]
name = "smithay"
version = "0.3.0"
source = "git+https://github.com/smithay//smithay?rev=bf0d4cb#bf0d4cb6a50f671f33083d0ab6a078529583834a"
source = "git+https://github.com/pop-os/smithay?branch=x11_fixes#15dd1675840295062cee4494fa6d49440ec0f04c"
dependencies = [
"appendlist",
"ash",

View file

@ -88,4 +88,4 @@ debug = true
lto = "fat"
[patch."https://github.com/Smithay/smithay.git"]
smithay = { git = "https://github.com/smithay//smithay", rev = "bf0d4cb" }
smithay = { git = "https://github.com/pop-os/smithay", branch = "x11_fixes" }

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(),