1
0
Fork 0
forked from wry/wry

xwayland: disallow focusing invisible windows

This commit is contained in:
Julian Orth 2022-06-04 14:07:34 +02:00
parent 6e244a08ab
commit a474033bff

View file

@ -22,7 +22,7 @@ use {
rect::Rect, rect::Rect,
state::State, state::State,
time::Time, time::Time,
tree::ToplevelNode, tree::{Node, ToplevelNode},
utils::{ utils::{
bitflags::BitflagsExt, buf::Buf, clonecell::CloneCell, copyhashmap::CopyHashMap, bitflags::BitflagsExt, buf::Buf, clonecell::CloneCell, copyhashmap::CopyHashMap,
errorfmt::ErrorFmt, linkedlist::LinkedList, numcell::NumCell, oserror::OsError, errorfmt::ErrorFmt, linkedlist::LinkedList, numcell::NumCell, oserror::OsError,
@ -1757,18 +1757,21 @@ impl Wm {
let new_window = self.windows.get(&event.event); let new_window = self.windows.get(&event.event);
let mut focus_window = self.focus_window.as_ref(); let mut focus_window = self.focus_window.as_ref();
if let Some(window) = new_window { if let Some(window) = new_window {
if let Some(w) = window.window.get() {
if let Some(prev) = focus_window { if let Some(prev) = focus_window {
let prev_pid = prev.info.pid.get(); let prev_pid = prev.info.pid.get();
let new_pid = window.info.pid.get(); let new_pid = window.info.pid.get();
if prev_pid.is_some() if prev_pid.is_some()
&& prev_pid == new_pid && prev_pid == new_pid
&& revent.serial() >= self.last_input_serial && revent.serial() >= self.last_input_serial
&& w.surface.node_visible()
{ {
// log::info!("xwm ACCEPT"); // log::info!("xwm ACCEPT");
focus_window = new_window; focus_window = new_window;
} }
} }
} }
}
let fw = focus_window.cloned(); let fw = focus_window.cloned();
self.focus_window(fw.as_ref(), Initiator::X).await; self.focus_window(fw.as_ref(), Initiator::X).await;
Ok(()) Ok(())