Skip to content

Commit

Permalink
xwm: Fix stacking order
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Oct 25, 2023
1 parent 2816207 commit 4642a08
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -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" }
22 changes: 3 additions & 19 deletions src/shell/focus/mod.rs
Expand Up @@ -3,7 +3,6 @@ use crate::{
state::Common,
utils::prelude::*,
wayland::handlers::xdg_shell::PopupGrabData,
xwayland::XWaylandState,
};
use indexmap::IndexSet;
use smithay::{
Expand Down Expand Up @@ -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| {
Expand All @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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())
}
}
13 changes: 0 additions & 13 deletions src/shell/mod.rs
Expand Up @@ -1402,19 +1402,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);
Expand Down
2 changes: 1 addition & 1 deletion src/shell/workspace.rs
Expand Up @@ -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(),
Expand Down

0 comments on commit 4642a08

Please sign in to comment.